equal
deleted
inserted
replaced
214 if ( container[i].in ) i=0; |
214 if ( container[i].in ) i=0; |
215 else i=-2; |
215 else i=-2; |
216 } |
216 } |
217 return state_enum(i); |
217 return state_enum(i); |
218 } |
218 } |
|
219 |
|
220 /// \brief Sets the state of the \c item in the heap. |
|
221 /// |
|
222 /// Sets the state of the \c item in the heap. It can be used to |
|
223 /// manually clear the heap when it is important to achive the |
|
224 /// better time complexity. |
|
225 /// \param i The item. |
|
226 /// \param st The state. It should not be \c IN_HEAP. |
|
227 void state(const Item& i, state_enum st) { |
|
228 switch (st) { |
|
229 case POST_HEAP: |
|
230 case PRE_HEAP: |
|
231 if (state(i) == IN_HEAP) { |
|
232 erase(i); |
|
233 } |
|
234 index[i] = st; |
|
235 break; |
|
236 } |
|
237 } |
219 |
238 |
220 private: |
239 private: |
221 |
240 |
222 void balance(); |
241 void balance(); |
223 void makeroot(int c); |
242 void makeroot(int c); |