views:

174

answers:

4

Are they AVL trees, red-black trees, or something else?

+6  A: 

Red-black trees as described in the first line of the javadoc.

Chris
+4  A: 

The first sentence of the TreeMap Javadoc states:

A Red-Black tree based NavigableMap implementation.

matt b
+5  A: 

From the java.util.TreeMap<K,V> documentation:

A Red-Black tree based NavigableMap implementation.

For questions like these, you should always first consult the documentation. The API shouldn't describe ALL of the inner-workings of a class, but elementary informations such as general data structures and algorithms used are usually documented.


Other Java Collections Framework trivias

These are all little trivias that are also clearly documented:

Related questions

polygenelubricants
A: 

TreeSet is based on TreeMap. And they uses red-black tree, red-black tree is a kind of AVL.

卢声远 Shengyuan Lu
Red-black trees and AVL trees are two different things.
Craig P. Motlin