Maciej Januszewski
Maciej Januszewski

Reputation: 31

BST tree - dictionary in Java

Does anyone would tell me if there's somewhere an implementation of using binary trees with creating a dictionary in Java ?

Upvotes: 0

Views: 511

Answers (2)

John Eipe
John Eipe

Reputation: 11236

Yes. You could use TreeMap class.

Documentation says it's implemented with Red black trees.

A red-black tree is a binary search tree where each node has a color attribute, the value of which is either red or black. In addition to the ordinary requirements imposed on binary search trees, the following additional requirements apply to red-black trees

If you want to know more, check out the source.

Upvotes: 0

SLaks
SLaks

Reputation: 888203

That's exactly what the TreeMap class does.

Upvotes: 1

Related Questions