New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeMultimap.create(TreeMultimap) takes O(n log n) #1579
Comments
Original comment posted by lowasser@google.com on 2013-11-13 at 05:44 PM (No comment entered for this change.) Owner: lowasser@google.com |
Original comment posted by lowasser@google.com on 2013-11-13 at 05:47 PM To be clear: is that actually quadratic time? I understand that it's the worst case scenario, but I'm not sure I follow why that would lead to quadratic time instead of O(n log n). |
Original comment posted by jbel...@datastax.com on 2013-11-13 at 05:56 PM My apologies, O(n log n) is correct. I'm not sure if there is a way to edit the issue title. |
Original comment posted by lowasser@google.com on 2013-11-13 at 06:03 PM (No comment entered for this change.) |
Pull request welcome. |
Should TreeMultimap.create(TreeMultimap) be a new method in API? IMO TreeMultimap.create(TreeMultimap) should be a new method with specification like in java TreeMap - new TreeMultimap with ordering from other TreeMultimap. |
Pull request: |
Original issue created by jbel...@datastax.com on 2013-11-13 at 05:29 PM
Inserting into a binary tree in sorted order is the worst case scenario for a red-black tree like the one backing TreeMultimap, and that's exactly what happens when you call putAll on another TreeMultimap.
Prior art: TreeMap special cases new-from-SortedMap via buildFromSorted.
The text was updated successfully, but these errors were encountered: