Changeset 8540
- Timestamp:
- 08/30/12 11:20:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/PriorityQueues/BinaryHeap.cs
r8539 r8540 24 24 data[i] = new KNElement(); 25 25 } 26 data[0].Key = infimum; // sentinel26 data[0].Key = infimum; 27 27 data[capacity + 1].Key = sup; 28 28 supremum = sup; … … 60 60 } 61 61 62 data[1] = data[size]; 62 data[1].Key = data[size].Key; 63 data[1].Value = data[size].Value; 64 63 65 data[size].Key = supremum; 64 66 size--; … … 87 89 int hole = size; 88 90 while ((hole > 1) && (data[hole >> 1].Key.CompareTo(key) == 1)) { 89 data[hole] = data[hole >> 1]; 91 data[hole].Key = data[hole >> 1].Key; 92 data[hole].Value = data[hole >> 1].Value; 90 93 hole = hole >> 1; 91 94 } … … 95 98 96 99 public void DecreaseKey(K key, V value) { 97 int pos = size;98 while ((pos > 1) && (data[pos >> 1].Key.CompareTo(key) != 0)) {99 pos = pos >> 1;100 }101 if (data[pos].Key.CompareTo(key) != 0) {102 throw new InvalidOperationException("Key not found");103 }104 100 throw new NotImplementedException(); 105 101 } 106 107 108 102 109 103 // reset size to 0 and fill data array with sentinels
Note: See TracChangeset
for help on using the changeset viewer.