equal
deleted
inserted
replaced
99 /// |
99 /// |
100 int find(const Item& a) { |
100 int find(const Item& a) { |
101 return repIndex(index[a]); |
101 return repIndex(index[a]); |
102 } |
102 } |
103 |
103 |
|
104 /// \brief Clears the union-find data structure |
|
105 /// |
|
106 /// Erase each item from the data structure. |
|
107 void clear() { |
|
108 items.clear(); |
|
109 } |
|
110 |
104 /// \brief Inserts a new element into the structure. |
111 /// \brief Inserts a new element into the structure. |
105 /// |
112 /// |
106 /// This method inserts a new element into the data structure. |
113 /// This method inserts a new element into the data structure. |
107 /// |
114 /// |
108 /// The method returns the index of the new component. |
115 /// The method returns the index of the new component. |
281 t.parent = k; |
288 t.parent = k; |
282 |
289 |
283 --items[k].parent; |
290 --items[k].parent; |
284 |
291 |
285 items.push_back(t); |
292 items.push_back(t); |
|
293 } |
|
294 |
|
295 /// \brief Clears the union-find data structure |
|
296 /// |
|
297 /// Erase each item from the data structure. |
|
298 void clear() { |
|
299 items.clear(); |
|
300 firstClass = -1; |
286 } |
301 } |
287 |
302 |
288 /// \brief Finds the leader of the component of the given element. |
303 /// \brief Finds the leader of the component of the given element. |
289 /// |
304 /// |
290 /// The method returns the leader of the component of the given element. |
305 /// The method returns the leader of the component of the given element. |