
590 A Practical Guide to Data Structures and Algorithms Using Java
time
method complexity disk pages read
constructors O(1) 0
ensureCapacity(x) O(1) 0
iterator() O(1) 0
iteratorAtEnd() O(1) 0
trimToSize() O(1) 0
max() O(1) 1
min() O(1) 1
predecessor(o) O(1) 1
successor(o) O(1) 1
contains(o) O(log
2
n) log
t
n
getLocator(o) O(log
2
n) log
t
n
getEquivalentElement(o) O(log
2
n) log
t
n
add(o) O(t log
t
n) 2 log
t
n
remove(o) O(t log
t
n) 2 log
t
n
accept(v) O(n) n/(t − 1)
toArray() O(n) n/(t − 1)
toString() O(n) n/(t − 1)
retainAll(c) O(n|c| + n log
t
n) 2|c|log
t
n
addAll(c) O(|c|log
t
(n + |c|) 2|c|log
t
(n + |c|)
Table 37.7 Summary of the asymptotic time complexities for the collection public ...