|
|
|
|
|
by shihab
224 days ago
|
|
I'm curious what you did with the "active sorting range" after a push/pop event. Since it's a vector underneath, I don't see any option other than to sort the entire range after each event, O(N). This would surely destroy performance, right? |
|
When adding an item, it gets added to the next unused vector element. The sorting range end offset gets updated.
Then it sorts (note you would actually need a custom sort since a PriorityQueue is a pair)
Adding an item would be something like: Or maybe I just used Popping an item: [1] Im writing this from memory from my attempt many months ago. May have mistakes.. but should communicate the jist