Question bank › Binary Search Tree
Dsa Binary Search Tree Easy

Find the Kth Smallest in BST

Write a program that finds the Kth smallest element in a binary search tree (BST). The program will read a series of integers that represent level-order insertion into the BST. The K value will be given as a separate input. Input Format: A single line containing integers separated by spaces for the BST, followed by a new line containing an integer K. Output Format: Print the Kth smallest element of the BST. If K is larger than the number of nodes, print 'OUT OF BOUNDS'. Example: Input: 5 3 8 1 4 3 Output: 4

Key concepts

binary_search_treekth_smallestin-order_traversal

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.