Java TreeMap time complexity - lowerKey - Stack Overflow
lowerKey()
is a search in a balanced binary search tree, so it's obviously O(log n)
. You might want to read the source code, e.g. from here, to see how the tree is traversed.
Similarly, each operation with a NavigableMap
returned from subMap()
also requires O(log n)
because you will need to traverse the tree to find elements you want.
Read full article from Java TreeMap time complexity - lowerKey - Stack Overflow
No comments:
Post a Comment