+ 2

Binary Tree

How to do insertion in binary trees?

22nd Jan 2020, 12:07 AM
Momin Musa
Momin Musa - avatar
4 Respostas
+ 6
You traverse the tree. If the value of the new element is less than that of the current node, you traverse left, otherwise you traverse right until you find the place to insert. If the last node found is a leaf node you insert the new element either to the left or right of it depending on the value.
22nd Jan 2020, 12:25 AM
Sonic
Sonic - avatar
+ 3
Perhaps Google or YouTube could help.
22nd Jan 2020, 12:25 AM
Sonic
Sonic - avatar
+ 1
It depends on which programming language you want. This page might help you: https://www.geeksforgeeks.org/insertion-in-a-binary-tree-in-level-order/
22nd Jan 2020, 12:23 AM
Cristóvão Vinagre
Cristóvão Vinagre - avatar
+ 1
You can check out also some implementation code below the community lesson https://www.sololearn.com/learn/322/?ref=app
22nd Jan 2020, 2:51 AM
Tibor Santa
Tibor Santa - avatar