Data Structure Questions and Answers-Splay Tree
What are splay trees?
self adjusting binary search trees
self adjusting binary trees
a tree with strings
a tree with probability distributions
Question 1 Explanation:
Splay trees are height balanced, self adjusting BST's.
Which of the following property of splay tree is correct?
it holds probability usage of the respective sub trees
any sequence of j operations starting from an empty tree with h nodes atmost, takes O(jlogh) time complexity
sequence of operations with h nodes can take O(logh) time complexity
splay trees are unstable trees
Question 2 Explanation:
This is a property of splay tree that ensures faster access. we push the most recently used nodes to top which leads to faster access to recently used values.
Why to prefer splay trees?
easier to program
easier to program and faster access to recently accessed items
Question 3 Explanation:
Whenever you insert an element or remove or read an element that will be pushed or stored at the top which facilitates easier access or recently used stuff.
Is it true that splay trees have O(logn) amortized complexity?
Question 4 Explanation:
We go with amortized time complexity when we feel that not all operations are worst and some can be efficiently done. in splay trees not all splay operations will lead to O(logn) worst case complexity.
What is a splay operation?
moving parent node to down of child
moving a node to root
moving root to leaf
removing leaf node
Question 5 Explanation:
Splay trees mainly work using splay operations. wheneve we insert, delete and search for a node we splay the respective nodes to root. we have zig-zag and zig-zig operations.
There are 5 questions to complete.