Thursday, 14 December 2017

Write a algorithm to implement cursor using the Linked list ADT.

STEP 1: Start.
STEP 2: Create an empty linked list using the structure with the information and link Field, create pointers to the next node.
STEP 3: Get the option from the user for the list operations.
1. add_node_at_end.
2. display list.
3. delete_start_node. 
4. delete_end_node.
5. move_current_on. 
6. move_current_back, 
STEP 4: If the choice is add_node_at_end, get the input number from the user, if the number is -1 then the link to the next node is made NULL, else create the memory for the new node.
STEP 5: If the choice is display list, print the information of each node until the link oft the node is NULL.
STEP 6.1:If the choice is deletion at start or end node, Get the data to be deleted and search the list until the data is matched.
STEP 6.2: If the data matches change the link of the previous node to point the next node of the deletion node.
STEP 7: If the choice is move _current_on you are at the end of the list. If the choice is move_current_back you are at the start of the list
STEP 8: Stop.

Mukesh Rajput

No comments:

Post a Comment

Mukesh Rajput