Skip to content

TreeSet remove method time complexity is O(n) #4

@GaoangLiu

Description

@GaoangLiu

From your implementation code,

self._treeset.remove(element)

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions