-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Implement two methods : clear_under() and clear_over() that accept a priority as an argument.
This will essentially truncate the size of the data structure, marking all items over/under this priority as trash/nonexistent.
This would be an O(log(n)) complex operation, as It would take a maximum of log(n) time to sort the structure, and thus, find the upper bound and lower bound of this priority. It would be O(1) to mark the rest of the dataset as trash. (e.g. an iter would return a slice of the min element to this new priority)
This would be a great convenience as it would give this data structure the ability to greatly speed up pruning operations. Currently pruning is O(n) at best, as you can only remove one element at a time. (It is possible to prune the entire set in O(1) using clear but that is besides my point)