COIN-OR::LEMON - Graph Library

Changeset 752:39a5b48bcace in lemon for lemon/fourary_heap.h


Ignore:
Timestamp:
07/10/09 09:17:13 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Small improvements in heap implementations (#301)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/fourary_heap.h

    r750 r752  
    166166
    167167    void bubbleDown(int hole, Pair p, int length) {
    168       int child = firstChild(hole);
    169       while( child<length && length>1 ) {
    170         child = findMin(child,length);
    171         if( !less(_data[child], p) )
    172           goto ok;
    173         move(_data[child], hole);
    174         hole = child;
    175         child = firstChild(hole);
     168      if( length>1 ) {
     169        int child = firstChild(hole);
     170        while( child<length ) {
     171          child = findMin(child, length);
     172          if( !less(_data[child], p) )
     173            goto ok;
     174          move(_data[child], hole);
     175          hole = child;
     176          child = firstChild(hole);
     177        }
    176178      }
    177179    ok:
Note: See TracChangeset for help on using the changeset viewer.