@@ -12,6 +12,7 @@ The library that realizes a heap based priority queue.
1212
1313Courtesy of heap property,
1414add() and removeTop() operations are O(log(n)) complex
15+ remove() operation is O(n) for search + O(log(n)) for removal
1516top(), topValue() operations are O(1)
1617
1718The library might be useful to implement priority withdrawals/purchases, reputation based systems, and similar logic.
@@ -116,6 +117,33 @@ Parameters:
116117| :---- | :----------------------------- | :---------- |
117118| queue | struct PriorityQueue.UintQueue | self |
118119
120+ ### remove
121+
122+ ``` solidity
123+ function remove(
124+ PriorityQueue.UintQueue storage queue,
125+ uint256 value_
126+ ) internal returns (bool)
127+ ```
128+
129+ The function to remove a specific element from the uint256 queue. O(n) complex for search + O(log(n)) for removal
130+ In case of duplicate elements, removes the one with the highest priority.
131+
132+
133+ Parameters:
134+
135+ | Name | Type | Description |
136+ | :----- | :----------------------------- | :--------------------------- |
137+ | queue | struct PriorityQueue.UintQueue | self |
138+ | value_ | uint256 | the element value to remove |
139+
140+
141+ Return values:
142+
143+ | Name | Type | Description |
144+ | :--- | :--- | :----------------------------------------------------- |
145+ | [ 0] | bool | true if element was found and removed, false otherwise |
146+
119147### topValue
120148
121149``` solidity
@@ -260,6 +288,17 @@ function removeTop(PriorityQueue.Bytes32Queue storage queue) internal
260288```
261289
262290The function to remove the element with the highest priority. O(log(n)) complex
291+ ### remove
292+
293+ ``` solidity
294+ function remove(
295+ PriorityQueue.Bytes32Queue storage queue,
296+ bytes32 value_
297+ ) internal returns (bool)
298+ ```
299+
300+ The function to remove a specific element from the bytes32 queue. O(n) complex for search + O(log(n)) for removal
301+ In case of duplicate elements, removes the one with the highest priority.
263302### topValue
264303
265304``` solidity
@@ -328,6 +367,17 @@ function removeTop(PriorityQueue.AddressQueue storage queue) internal
328367```
329368
330369The function to remove the element with the highest priority. O(log(n)) complex
370+ ### remove
371+
372+ ``` solidity
373+ function remove(
374+ PriorityQueue.AddressQueue storage queue,
375+ address value_
376+ ) internal returns (bool)
377+ ```
378+
379+ The function to remove a specific element from the address queue. O(n) complex for search + O(log(n)) for removal
380+ In case of duplicate elements, removes the one with the highest priority.
331381### topValue
332382
333383``` solidity
0 commit comments