Académique Documents
Professionnel Documents
Culture Documents
IRCULAR QUEUE
IMPLEMENTATION OF BI
NARY SEARCH TREE
1. Start the program
2. create the structure.
3. In insert() method, the root value is checked to be NULL,then the node is cre
ated as a root node else the new value is inserted as left child(if<root) or as
right child(if>root).
4. In del()method,the link to the parent node from the leaf is made NULL and the
memory is released.
5. In print()method, the element of the tree are printed in any of the following
below
* In inorder() traversal,the element of the tree are traversed in Lef
t,Root,Right(LNR) order.
* In preorder() traversal,the element of the tree are traversed in Roo
t,Left,Right(NLR) order.
* In postorder() traversal, the elements of the tree are traversed in
Left,Right,Root(LRN) order.
6. In main() method, the choice is obtained from the user using the switchcase s
tatements.
7. stop the program.
IMPLEMENTATIO
N OF HASH TABLE
1. Start the program.
2. Declare and intialize the required variables.
3. Get the size of the hash table from the user and make the indices sequentiall
y based on size.
4. Get the integer number from the user and compute the hash function for the gi
ven number using the formula
/* Hash function= (int)e % size of the hash table */
5. Finally store the number in corresponding location in the hash table.
6. Check whether the hash table is empty or full during insertion and deletion f
unctions.
7. Print the contents of the hash table whether the user needs to view.
8. Stop the program.
IMPLEMENTATION OF HEAP
1. Start the program.
2. Intialize and declare the variables & arrays.
3. In insert() method, the elements of the heap are inserted into the array,sati
sfying the heap tree condition that ROOT >CHILD.
Left-> inserted at 2p+1 position.
Right-> inserted at 2p+2 position ,where p is the position of the root.
4. In del() method,the deletion from the other end of the sorted array taks plac
e.
5. In display() method, the elements of the hear are displayed.
6. In main() method,the method are selected by the user using the switch case st
atements
7. Stop the program.
AVL ROTATION
1. Start the program.
2. Intialize the variables.
3.In max() method,the greatest of the two integer are obtained.
4. In height() method,height (AVL tree) is returned with height(single node)=0.
5. In insert() method,if tree->empty element is inserted as root node. Else the
nodes are traversed the element is inserted such that ROOT>LEFT & ROOT<RIGHT.
6. In s_rotate_left() method and s_rotate_right() method the unbalanced right &
left nodes are rotated left & right respectively.
7.In d_rotate_left () method and d_rotate_right() method the nodes are rotated
right and then left respectively.
8. The user using main() method switchcase statements.
9. Stop the program.