Binary Search Tree - Java Implementation

user1696230 picture user1696230 · Nov 14, 2012 · Viewed 114k times · Source

I'm writing a program that utilizes a binary search tree to store data. In a previous program (unrelated), I was able to implement a linked list using an implementation provided with Java SE6. Is there something similar for a binary search tree, or will I need to "start from scratch"?

Answer

Emil Sit picture Emil Sit · Nov 14, 2012

You can use a TreeMap data structure. TreeMap is implemented as a red black tree, which is a self-balancing binary search tree.