sirinibin / binarytree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binary tree search example using console


This is a Binary tree search example using console

INSTALLATION & EXECUTION

Step1:Clone the source code
git clone -b master https://github.com/sirinibin/binarytree.git

Step2: cd binarytree
Step4: php index.php elements.csv 45

O/P:

Given B-tree elements:
1 3 4 23 26 31 45

Searching item 45:

Checking root Node:1
Not found,so moving to the right child of Node:1 as Search item 45 is > Node 1

Checking Node: 3
Not found,so moving to the right child of Node: 3 as Search item 45 is > Node  3

Checking Node: 4
Not found,so moving to the right child of Node: 4 as Search item 45 is > Node  4

Checking Node: 23
Not found,so moving to the right child of Node: 23 as Search item 45 is > Node  23

Checking Node: 26
Not found,so moving to the right child of Node: 26 as Search item 45 is > Node  26

Checking Node: 31
Not found,so moving to the right child of Node: 31 as Search item 45 is > Node  31

Checking Node: 45
Result:Item found in Node: 45

About


Languages

Language:PHP 100.0%