Considering the current sad state of our computer programs, software development is clearly still a black art, and cannot yet be called an engineering discipline. Bill Clinton
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.
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