[ACCEPTED]-Red Black tree or AVL tree implementation in Java-guava
Basically I am looking for a data structure 11 where the queries should happen in O(lg 10 n) time
Use a TreeMap. It is backed by a Red-Black tree so it's 9 access time is O(logN)
(my emphasis on quote bellow)
public 8 class TreeMap
extends AbstractMap implements
NavigableMap, Cloneable, Serializable 7A Red-Black tree based NavigableMap implementation. The 6 map is sorted according to the natural 5 ordering of its keys, or by a Comparator provided 4 at map creation time, depending on which 3 constructor is used.
This implementation 2 provides guaranteed log(n) time cost for the containsKey, get, put 1 and remove operations.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.