Data Structure Questions and Answers-Splay Tree


 Help authour, Buy PDF Ebook   >>>Click Here<<<

Data Structure Questions and Answers-Splay Tree

Click on any option to know the CORRECT ANSWERS

Question 6
Which of the following options is an application of splay trees?
cache Implementation
send values
receive values
Microbiology Questions answers

Question 6 Explanation: 
Splay trees can be used for faster access to recently accessed items and hence used for cache implementations.

Question 7
When we have red-black trees and AVL trees that can perform most of operations in logarithmic times, then what is the need for splay trees?
no there is no special usage
In real time it is estimated that 80% access is only to 20% data, hence most used ones must be easily available
redblack and avl are not upto mark
they are just another type of self balancing binary search trees
ICT Questions answers

Question 7 Explanation: 
May be the stats showing 80-20% may be not accurate, but in real time that is the widely spread scenario seen. If you are into this type of situation, you must choose implementing splay trees.

Question 8
After the insertion operation, is the resultant tree a splay tee?
History Questions answers

Question 8 Explanation: 
There is a zig-zag and right operation(zig) which gives the right hand side tree. refer splay operations for insertion in splay tree.

Question 9
What output does the below pseudo code produces?

 Tree....node function(Tree....node x) { Tree....node y = x.left; x.left = y.right; y.right = x; return y; }
right rotation of subtree
left rotation of subtree
zig-zag operation
zig-zig operation
English grammar Questions answers

Question 9 Explanation: 
When a right rotation is done the parent of the rotating node becomes it's right node and it's child becomes it's left child.

Question 10
What is the disadvantage of using splay trees?
height of a splay tree can be linear when accessing elements in non decreasing order.
splay operations are difficult
no significant disadvantage
splay tree performs unnecessary splay when a node is only being read
HRM Questions answers

Question 10 Explanation: 
This will be the case after accessing all n elements in non-decreasing order. Since the height of a tree corresponds to the worst-case access time, this means that the actual cost of an operation can be high. However the amortized access cost of this worst case is logarithmic O(log n).

There are 10 questions to complete.


 Download all FREE PDF Ebook >>>CLICK HERE<<<