Dsa
Binary Search Tree
Easy
BST Insertion Order
Given an array of unique integers, write a program that constructs a binary search tree (BST) by inserting the integers in the order they appear in the array. Then, print the in-order traversal of the BST.
Input Format:
A single line containing unique integers separated by spaces.
Output Format:
Print all the integers in the BST in ascending order, separated by a space.
Example:
Input:
5 3 8 1 4
Output:
1 3 4 5 8
Key concepts
binary_search_treeinsertiontraversal
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