Write an algorithm for array implementation of List ADT.
Algorithm for solving above problem:
Step 1: Start
Step 2: Create an empty list using structure that includes data and position of a Node
Step 3: Set the maximum size for the list and initialize position to O.
Step 4: Get the choice from the user
a. Insertion
b. Deletion
c. Traversal ( Display)
d. Exit
Step 5: Get the choice from the user.
Step 5.1: If choice = insertion,
Check if node position = maximum size, Display" List Overflow"
Otherwise store the data into the list and increment the position by one.
Step 5.2: If choice = deletion
Delete the data from the list and decrement the position by one.
Step 5.3: If choice = display
Display the stored data from the list
Step 6: Stop
Thanks
Mukesh Rajput
Post A Comment:
0 comments:
Thanks
Mukesh Rajput