开发者

TreeMap - Search Time Complexity

What is the time complexity of a get() and put() in a TreeMap?

Is the implementation same as a Red-Black T开发者_如何学Goree?


From here: http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html

This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations


TreeMap is:

A Red-Black tree based NavigableMap implementation.

This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations. Algorithms are adaptations of those in Cormen, Leiserson, and Rivest's Introduction to Algorithms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜