Alg in Ds
Alg in Ds
AIM
To write a python program to implement list ADT using array
ALGORITHM
1. Start the program.
2. Read the number of elements in the list and create the list.
6. Remove the element from the list and adjust the position.
RESULT:
Thus a Python program to implement the List using array is written and
executed successfully.
1 (b). LIST ADT USING LINKED LIST
AIM
To write a python program to implement list ADT using linked list
ALGORITHM
1. Start the program.
RESULT:
Thus a python program to implement the List ADT using linked list is written and
executed successfully.
To write a python program to implement the stack using singly linked list.
ALGORITHM:
A) Push Operation:
1. To push an element into the stack, copy the element to be inserted in the data field
of the new node.
2. Assign the reference field of the new node as NULL.
3. Check if top is not NULL, if so, then assign the value of top in the reference field of
new node.
4. Assign the address of the new node to the top.
B) Pop Operation:
1. To pop an element from the stack, check whether the top of the stack is NULL.
2. If so, then return stack is empty and element cannot be popped from the stack.
3. Else, assign the top value to a temporary node.
4. Now assign the value in the reference field of the node pointed by top to the top
value.
5. Return the value in the data field of the temporary node as the element deleted and
delete the temporary node.
RESULT:
Thus a python program to implement the stack using linked list is written and
executed successfully.
ALGORITHM:
ENQUEUE:
1. Create a new node and allocate memory space for the new node.
2. Assign the element to be inserted in the data field of the new node.
5. If so, then make the front and rear pointers to point to new node.
6. If not, then assign address of the new node as the rear pointer value.
DEQUEUE:
3. If not, assign the front->next value as the new front pointer and free the deleted node.
RESULT:
Thus a python program to implement the queue using linked list is written and executed
Successfully
3. INFIX EXPRESSION CONVERTS THE EXPRESSION TO POSTFIX FORM USING
SATCK ADT
AIM:
ALGORITHM:
RESULT:
To write a python program to implement the priority of queue ADT using linked list.
ALGORITHM:
RESULT:
Thus a python program to implement the priority of queue ADT using linked list is
written and executed successfully
ALGORITHM:
7. Find the searching node and display if it is present with parent node.
RESULT:
Thus a python program to implement the binary search tree is written and executed
successfully.
6. AVL- TREE