THE LIST ADT

List is an ordered set of elements.
The general form of the list is
A1, A2, A3, ..... ,AN
A1 - First element of the list
AN - Last element of the list
N - Size of the list

If the element at position i is Ai then its successor is Ai+1 and its predecessor is Ai-1.
Various operations performed on List

1. Insert (X, 5) - Insert the element X after the position 5.
2. Delete (X) - The element X is deleted
3. Find (X) - Returns the position of X.
4. Next (i) - Returns the position of its successor element i+1.
5. Previous (i) - Returns the position of its predecessor i-1.
6. Print list - Contents of the list is displayed.
7. Makeempty - Makes the list empty.

Implementation of List ADT
1. Array Implementation
2. Linked List Implementation
3. Cursor Implementation

Array Implementation of List

Array is a collection of specific number of data stored in a consecutive memory locations.
* Insertion and Deletion operation are expensive as it requires more data movement
* Find and Printlist operations takes constant time.
* Even if the array is dynamically allocated, an estimate of the maximum size of the
list is required which considerably wastes the memory space.

learn more
The Queue ADT
Previous
Next Post »