This is the code I have written. Please confirm that we have to first sort the array to make BST.
Also please explain how to take level order input from a user.
This is the code I have written. Please confirm that we have to first sort the array to make BST.
Also please explain how to take level order input from a user.
The array given in the input is not the preorder traversal of the BST to be formed. It is just a random unsorted array and you need to create a BST from the given unsorted array.
https://ide.codingblocks.com/s/331100 I have attached the code of the input method for your reference. The code in the video was for sorted arrays
How do we create a BST if we are given a unsorted array ?
build a normal bst by inserting elements one by one and then apply ur logic
https://ide.codingblocks.com/s/331100 I have attached the code of the input method of your reference. The code in the video was for sorted arrays