C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

[FEATURE] Construct Binary Search Tree from Preorder Traversal

Open Amisha2093 opened this issue 2 years ago • 7 comments

Detailed description

Construct Binary Search Tree from Preorder Traversal.

Problem Statement: Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root.

Test Case: Input: preorder = [8,5,1,7,10,12] Output: [8,5,10,1,7,null,12]

Context

This is a very famous and standard problem asked in most of the interviews. This will enhance the logical thinking of the programmer.

Possible implementation

A binary search tree is a binary tree where for every node, any descendant of Node.left has a value strictly less than Node.val, and any descendant of Node.right has a value strictly greater than Node.val.

A preorder traversal of a binary tree displays the value of the node first, then traverses Node.left, then traverses Node.right.

Additional information

No response

Amisha2093 avatar Oct 13 '22 15:10 Amisha2093

I would also like to contribute a solution to this problem.

abhisek247767 avatar Oct 13 '22 16:10 abhisek247767

Hello Maintainer, I want to solve this problem ,please assign this issue to me.

BugsBunny-PG avatar Oct 13 '22 17:10 BugsBunny-PG

Hello, Can you please assign this issue to me? Thanks in advance :)

Sakshi2002-Sinha avatar Oct 13 '22 19:10 Sakshi2002-Sinha

Hi sir/mam can you please assign this issue to me , i think i can do it very well

PrakarshSingh5 avatar Oct 14 '22 15:10 PrakarshSingh5

Hello sir! I am already done with this issue please assign me so I can handover you the code

ZohaiAli avatar Oct 18 '22 08:10 ZohaiAli

hello sir can you assign this issue to me i want to solve this issue.

Masoom9587 avatar Oct 21 '22 04:10 Masoom9587

I would like to contribute to the algorithm. Please assign this task to me.

Sakshiwalode28 avatar Oct 23 '22 09:10 Sakshiwalode28

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 07 '23 00:01 github-actions[bot]

Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

github-actions[bot] avatar Jan 15 '23 00:01 github-actions[bot]