gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Bug fix in PairingHeap::pop() (#301)
0 2 0
default
2 files changed with 12 insertions and 10 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -257,24 +257,26 @@
257 257
            TreeArray[i-2]=other;
258 258
          }
259 259
          fuse( TreeArray[i-2], TreeArray[i] );
260 260
          i-=2;
261 261
        }
262 262
        minimum = TreeArray[0];
263 263
      }
264 264

	
265 265
      if ( 0==num_child ) {
266 266
        minimum = container[minimum].child;
267 267
      }
268 268

	
269
      if (minimum >= 0) container[minimum].left_child = false;
270

	
269 271
      --num_items;
270 272
    }
271 273

	
272 274
    /// \brief Deletes \c item from the heap.
273 275
    ///
274 276
    /// This method deletes \c item from the heap, if \c item was already
275 277
    /// stored in the heap. It is quite inefficient in Pairing heaps.
276 278
    void erase (const Item& item) {
277 279
      int i=iimap[item];
278 280
      if ( i>=0 && container[i].in ) {
279 281
        decrease( item, container[minimum].prio-1 );
280 282
        pop();
Ignore white space 24 line context
... ...
@@ -213,34 +213,34 @@
213 213
  {
214 214
    typedef FibHeap<Prio, ItemIntMap> IntHeap;
215 215
    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
216 216
    heapSortTest<IntHeap>();
217 217
    heapIncreaseTest<IntHeap>();
218 218

	
219 219
    typedef FibHeap<Prio, IntNodeMap > NodeHeap;
220 220
    checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
221 221
    dijkstraHeapTest<NodeHeap>(digraph, length, source);
222 222
  }
223 223

	
224 224
  // PairingHeap
225
//  {
226
//    typedef PairingHeap<Prio, ItemIntMap> IntHeap;
227
//    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
228
//    heapSortTest<IntHeap>();
229
//    heapIncreaseTest<IntHeap>();
230
//
231
//    typedef PairingHeap<Prio, IntNodeMap > NodeHeap;
232
//    checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
233
//    dijkstraHeapTest<NodeHeap>(digraph, length, source);
234
//  }
225
  {
226
    typedef PairingHeap<Prio, ItemIntMap> IntHeap;
227
    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
228
    heapSortTest<IntHeap>();
229
    heapIncreaseTest<IntHeap>();
230

	
231
    typedef PairingHeap<Prio, IntNodeMap > NodeHeap;
232
    checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
233
    dijkstraHeapTest<NodeHeap>(digraph, length, source);
234
  }
235 235

	
236 236
  // RadixHeap
237 237
  {
238 238
    typedef RadixHeap<ItemIntMap> IntHeap;
239 239
    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
240 240
    heapSortTest<IntHeap>();
241 241
    heapIncreaseTest<IntHeap>();
242 242

	
243 243
    typedef RadixHeap<IntNodeMap > NodeHeap;
244 244
    checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
245 245
    dijkstraHeapTest<NodeHeap>(digraph, length, source);
246 246
  }
0 comments (0 inline)