A binary tree can be used to implement a simple but inefficient sorting algorithm. Here is a link from where you could learn to solve:

cslibrary.stanford.edu

cslibrary.stanford.edu

cslibrary.stanford.edu

First we allocate memory and assign value to the data filed of the new node. Make the left and right child filed of the new node point to null

second locate the new node that will be the parent of the node to be inserted marks it as parents

third if the value in the data feild of new node is less than of parent, make the left child of parents point to the new node

second locate the new node that will be the parent of the node to be inserted marks it as parents

third if the value in the data feild of new node is less than of parent, make the left child of parents point to the new node

Please give me binary tree algorithm.

Add a node in binary search tree?

X = y?

Didn't find the answer you were looking for?