Documentation is the castor oil of programming. Managers think it is good for programmers and programmers hate it. Gerald Weinberg

Sply Tree Implementation

Language Java | Level Intermediate | Category Data structure | September 17, 2015 2:48 am


Data structure Description

A splay tree is a self-adjusting binary search tree with the additional property that recently accessed elements are quick to access again. The splay tree has good performance during the average case and uses small memory compare than another tree.

The main disadvantage is that the height of the splay tree is linear. It may be difficult to handle in the multithreaded environment. Splay tree reshape the nodes to know frequently access elements which improve the better lookup time. Splay trees can only guarantee that any sequence of n operations takes at most O (n log n) time.

Write a program to implement the splay tree with insert and remove operations.


Output

   					 

Array of items insert into the splay tree:[45, 67, 34, 22, 89, 56, 78, 11]
Splay tree items after insert into Splay tree using post order:34 56 45 89 78 67 22 11 
Minimum item from Splay tree:11
Max item from Splay tree:89

				    

Comments


No comments available!

Please login to add comments.