TreeSet `remove` method time complexity is O(n)
Opened this issue · 1 comments
GaoangLiu commented
From your implementation code,
Line 67 in 5e24a51
I believe you're using Python
list
built-in remove
method to remove an element. The time complexity of this method is O(n)
.
However, Java TreeSet.remove()
is O(log n)
, I wonder is there any way to speed up the remove operation?
alanyee commented
This would require a custom class because the list and linked list implementations in Python have O(n)
stopgaps for trying to deleting an arbitrary value or index respectively.