15-11-2012, 04:03 PM
BINARY SEARCH TREE
BINARY SEARCH TREE.docx (Size: 19.13 KB / Downloads: 25)
Algorithm
1. [Include all the necessary header files.]
2. [Declare the structure with all necessary variables.]
3. Read x;
4. Call INORDER().
5. Call PREORDER().
6. Call POSTORDER().
7. Call display().
8.
Algorithm For INSERT(P,X)
1. If (pNULL)
Create P
P<-datax.
P->lchild PrchildNULL
Else
2.1 while(TEMP!=NULL)
2.2 Temp2Temp1
2.3 If(temp1datax)
2.4 Else Temp1Temp1rchild
2.5 [End of while structure]
2.6 If(temp2datax)
2.7 Temp 2Temp2lchild
2.8 Temp 2datax
2.9 Temp2dataslchildtemp2rchild Null