GATE CS 2021 Set 2 | Question 26
Programming & Data Structures › Trees · NAT · 1 mark · Answer: 1
- Question 26Programming & Data Structuresnat1 markConsider a complete binary tree with 7 nodes. Let denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root. The value of is ______.
Answer: 1
Solution
Number the nodes (root), (level 1), (level 2). BFS first three: . DFS first three: . , so .
More GATE PYQ on Trees
All GATE CS Programming & Data Structures PYQ →Attempt GATE CS 2021 Set 2 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →