Computational Complexity of TreeSet Methods in Java

Is the computational complexity of the TreeSet methods in Java the same as AVLTree?

In particular, I want to know the computational complexity of the following methods: 1.Add 2.Remove 3.First 4.last 5. floor 6. higher

Java Doc for method description: http://docs.oracle.com/javase/6/docs/api/java/util/TreeSet.html

Is there all O (logn) for the AVL tree? What is the complexity of the TreeSet methods described above?

+4
source share
1 answer

This is all O (ln n) comparisons except the first and last, which are O (1) comparisons or O (ln N) node search times.

+9
source

All Articles