If McDonalds were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ‘We’re sorry, here’s a coupon for two more.’ “ Mark Minasi
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