equal
deleted
inserted
replaced
163 } |
163 } |
164 move(p, hole); |
164 move(p, hole); |
165 } |
165 } |
166 |
166 |
167 void bubbleDown(int hole, Pair p, int length) { |
167 void bubbleDown(int hole, Pair p, int length) { |
168 int child = firstChild(hole); |
168 if( length>1 ) { |
169 while( child<length && length>1 ) { |
169 int child = firstChild(hole); |
170 child = findMin(child,length); |
170 while( child<length ) { |
171 if( !less(_data[child], p) ) |
171 child = findMin(child, length); |
172 goto ok; |
172 if( !less(_data[child], p) ) |
173 move(_data[child], hole); |
173 goto ok; |
174 hole = child; |
174 move(_data[child], hole); |
175 child = firstChild(hole); |
175 hole = child; |
|
176 child = firstChild(hole); |
|
177 } |
176 } |
178 } |
177 ok: |
179 ok: |
178 move(p, hole); |
180 move(p, hole); |
179 } |
181 } |
180 |
182 |