Create a Binary Tree using input value | C++ STL Queue | Bangla

Опубликовано: 13 Июнь 2026
на канале: CS Inside
1,312
23

In this video tutorial, I will show you how to create a binary tree from the user input value.

Algorithm:
1. Create a root node with a root value and making the left and right child initially null.
2. Insert the memory address of the root node in the queue.
3. Now repeated procedure start with a while loop, the loop should continue until the queue is not empty.
4. Take out the value from the queue and assign it to a temporary(tmp) pointer.
5. Now ask the value of the left child of tmp pointer if it is not (-1) create it with help of the newnode pointer. Then connect newnode with tmp left child and push newnode memory address in the queue.
6. Same as for the right child.
7. Display binary tree with inorder traversal.
Source code: https://drive.google.com/file/d/1IrCc...

【Other playlists】
Linked list: https://youtube.com/playlist?list=PLs...
Array: https://youtube.com/playlist?list=PLs...
【Check The Below Links】
INSTAGRAM:   / shanin_hoss​​.  .
FACEBOOK:   / shanin.hossa​​.  .
CONTACT: [email protected]
#construct_binary_tree #binary_tree_creation