My Report

Data Structure I Practice Test 6


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Which of the following tree traversals work if the null left pointer pointing to the predecessor and null right pointer pointing to the successor in a binary tree?

2. Why the below pseudo code where x is a value, wt is weight factor and t is root node can't insert?

WeightBalanceTreeNode insert(int x, int wt, WeightBalanceTreeNode k) :
       
           if (k == null)
                k = new WeightBalanceTreeNode(x, wt, null, null)
           else if (x < t.element) :
            
                k.left = insert (x, wt, k.left)
                if (k.left.weight < k.weight)
                    k = rotateWithRightChild (k)
            
            else if (x > t.element) :
            
                k.right = insert (x, wt, k.right)
                if (k.right.weight < k.weight)
                    k = rotateWithLeftChild (k)
 

3. Which of the following is true?

4. What does the below definations convey?
i. A binary tree is balanced if for every node it is gonna hold that the number of inner nodes in the left subtree and the number of inner nodes in the right subtree differ by at most 1.
ii. A binary tree is balanced if for any two leaves the difference of the depth is at most 1.

5. Which of the following is false?

6. Which node is the child node of Node D in the following ternary tree?
ternary-tree-multiple-choice-questions-answers-mcqs-q6

7. Is it true that splay trees have O(logn) amortized complexity ?

8. Which of the dynamic operations are used in Top Tree data structure implementation?

9. Which of the following is false?

10. Why Red-black trees are preferred over hash tables though hash tables have constant time complexity?


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.