Computational complexity of TreeSet operations in Java?

后端 未结 4 1452
暗喜
暗喜 2021-01-04 17:43

I am trying to clear up some things regarding complexity in some of the operations of TreeSet. On the javadoc it says:

\"This implementation provides

4条回答
  •  庸人自扰
    2021-01-04 18:12

    According to this blog post:
    http://rgrig.blogspot.com/2008/06/java-api-complexity-guarantees.html
    it's O(n log n). Because the documentation gives no hints about the complexity, you might want to write your own algorithm if the performance is critical for you.

提交回复
热议问题