Data Structures and Algorithms Design Week 5 Answers

Are you looking for Data Structures and Algorithms Design Week 5 Answers ? All weeks solutions of this Swayam course are available here.


Data Structures and Algorithms Design Week 5 Answers
Data Structures and Algorithms Design Week 5 Answers

Data Structures and Algorithms Design Week 5 Answers (July-Dec 2025)

Course link: Click here to visit course on Nptel Website


Question 1. Insert the keys in order: 45,20,60,10,35,50,70,25,40,55,65. Which of the following is the correct BST?

a) [Option 1 diagram]
b) [Option 2 diagram]
c) [Option 3 diagram]
d) [Option 4 diagram]

View Answers


Question 2. The following binary search tree is given. We insert the single key 52. Which of the following trees is the correct result after insertion?

a) [Option 1 diagram]
b) [Option 2 diagram]
c) [Option 3 diagram]
d) [Option 4 diagram]

View Answers


Question 3. Evaluate the postfix expression 1 2 + 12 3 / * 5 –

a) 60
b) 7
c) 2
d) 30

View Answers


Question 4. The following AVL tree is given. We insert the single key 13. Which of the following trees is the correct result after insertion and rebalancing?

a) [Option 1 diagram]
b) [Option 2 diagram]
c) [Option 3 diagram]
d) [Option 4 diagram]

View Answers


Question 5. Which of the following is always true for a Red–Black Tree?

a) The root node must always be red.
b) Every red node must have exactly two black children.
c) Every path from the root to a NULL leaf must have the same number of black nodes.
d) The height of a Red–Black Tree is always exactly log₂n.

View Answers

These are Data Structures and Algorithms Design Week 5 Answers


Question 6. A stack initially contains (from bottom to top): [1, 2, 3]. The following operations are performed in order:

push(4)
pop()
push(5)
push(pop() + pop())

What will be the final content of the stack (from bottom to top)?

a) [1, 2, 3, 4, 5]
b) [1, 2, 5, 4]
c) [1, 2, 8]
d) [8, 2, 1]

View Answers


Question 7. The following postfix expression is given: AB+CDE+∗∗. If it is converted to an equivalent fully parenthesized infix expression, which of the following is correct?

a) ((A+B)∗C)∗(D+E)
b) (A+B)∗(C∗D+E)
c) (A+B)∗(C∗(D+E))
d) A+(B∗(C∗(D+E)))

View Answers

These are Data Structures and Algorithms Design Week 5 Answers


Question 8. Consider the following binary tree. What is the postorder traversal of this tree?

a) D H I E B F G C A
b) H I E D B F G C A
c) D E H I B F G C A
d) D H I B E F G C A

View Answers


Question 9. Two stacks S1 and S2 have the following contents (listed bottom → top):
S1: [1,2,3]
S2: [4,5]

The following operations are executed in order:
1 – push(S1,6)
2 – pop(S2)
3 – push(S1, pop(S1)+pop(S2))
4 – push(S2, pop(S1))
5 – push(S1, pop(S2)+pop(S1))
6 – push(S2,7)

What are the final contents of the stacks (bottom → top)?

a) S1:[1,2,3,10], S2:[7]
b) S1:[1,2,3], S2:[10]
c) S1:[1,2,8], S2:[]
d) S1:[1,2,13], S2:[7]
e) S1:[1,2,13,7], S2:[]

View Answers


Question 10. Which of the following statements about AVL trees is TRUE?

a) An AVL tree of height h always contains exactly 2^(h+1) − 1 nodes.
b) After inserting a node into an AVL tree, at most one rotation is needed to restore balance.
c) The balance factor of any node in an AVL tree is always in the set {−1,0,1}.
d) Deleting a node from an AVL tree may require O(log n) rotations in the worst case.

View Answers


These are Data Structures and Algorithms Design Week 5 Answers

Click here for all nptel assignment answers