Vous êtes sur la page 1sur 2

IMPLEMENTATION OF C

IRCULAR QUEUE

1. start the program.


2. Include the necessary header files and declare & intialize the variables and
array.
3. In insert() method,several conditions are checked to find if the circular que
ue is full else the element is inserted.
4. In deletion() method, the condition(front==-1) is checked to find if the circ
ular queue is empty else the first element in the queue is deleted as queue is o
f FIFO type.
5. In display() method,the elements of the circular queue are printed.
6. In main() method, the menu is displayed and the choice is obtained from the u
ser.
7. Using the switch case statements,the appropriate method is called.
8. Stop the program.

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.

MULTISTACK IN SINGLE ARRAY


1.Start the program.
2. Declare the variable with their data types and also the arrays with sizes.
3. In main() method,the total numbr of stacks to be created is obtained from the
user using the switchcase statements and the choice obtained.
4. In setbound() method, the stacks are created.
5. In push() method, the stack is checked if it is full else the data is inserte
d to it.
6. In pop() method, the stack is checked if it is empty else the data is deleted
.
7.In display() method, the data in the stack is printed.
8. Stop the program.

Vous aimerez peut-être aussi