Question bank › Binary Search Tree
Dsa Binary Search Tree Warm-up

Level Order Traversal of BST

Given the root of a binary search tree (BST), implement a function `level_order_traversal(root)` that prints the values of the nodes in level order (breadth-first order). Each level of output should be on a new line. Input format: The first line contains an integer N, the number of nodes in the BST. The following N lines each contain an integer representing the value of the node. Output format: The values at each level should be printed on separate lines, space-separated. Example: Input: 5 2 1 3 4 5 Output: 2 1 3 4 5

Key concepts

binary_search_treelevel_ordertraversal

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.