Skip to main content

GATE CSE 2004Data Structures › Trees & Binary Search TreesVerified

GATE CSE 2004 PYQ: Level order traversal of a rooted tree can be done by starting from the root and performing

Level order traversal of a rooted tree can be done by starting from the root and performing

  1. A

    preorder traversal

  2. B

    in-order traversal

  3. C

    depth first search

  4. D

    breadth first search

    Correct answer

Answer

(D) breadth first search

Approach

Recognize that level-order traversal visits all nodes at the current depth before moving to the next depth. This is exactly the order produced by breadth-first search (BFS), which uses a queue starting from the root.

Level-order traversal is equivalent to breadth-first search on a rooted tree. It uses a queue to visit nodes depth by depth from the root.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.