Data Structures & AlgorithmsEasyTCS NQT · Wipro pattern
In a binary tree whose root is at level 0, what is the maximum number of nodes at level 5?
- A. 31
- B. 63
- C. 32
- D. 16
Correct answer: C. 32
Each level can at most double the previous one: 1, 2, 4, 8, 16, 32 → 2⁵ = 32 at level 5. 63 = 2⁶ − 1 is the maximum number of nodes in levels 0–5 combined; 31 is levels 0–4.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A simple directed graph (no self-loops, at most one edge from u to v) has 6 vertices. What is the maximum number of edges?
- Which algorithm finds shortest paths (by number of edges) from one source in an UNWEIGHTED graph in O(V + E) time?
- A binary tree is stored in level order in a 0-indexed array (children of i at 2i + 1 and 2i + 2; None = no node): [1, 2, 3, None, 4, 5]…
- The minimum is deleted from the min-heap [2, 5, 3, 9, 6, 4, 8] (0-indexed): the last element moves to the root and sifts down, swapping…
- An undirected graph has 6 vertices with degrees 3, 3, 2, 2, 2 and x, and it has 8 edges. What is x?
- Dijkstra's algorithm runs from S on the directed graph S→A (7), S→B (2), B→A (3), B→C (8), A→C (1), A→D (6), C→D (2). In what order are…