nextupprevious
Next:2.1.1 A Program with List ADTUp:2. ListsPrevious:2. Lists

2.1 List Abstract Data Type

A list is a sequence of zero or more elements of a given type 
a1, a2,..., an  (n$\displaystyle \geq$ 0)

 
$ \bullet$ n : length of the list
$ \bullet$ a1 : first element of the list
$ \bullet$ an : last element of the list
$ \bullet$ n = 0 : empty list
$ \bullet$ elements can be linearly ordered according to their position in the list
We say ai precedes ai + 1, ai + 1 follows ai, and ai is at position i
Let us assume the following:
L : list of objects of type element type
x : an object of this type
p : of type position
END(L) : a function that returns the position following the
    last position in the list L

Define the following operations:

1.
Insert (x, p, L)
2.
Locate (x, L)
3.
Retrieve (p, L)
4.
Delete (p, L)
5.
Next (p, L)
6.
Prev (p, L)
7.
Makenull (L)
8.
First (L)
9.
Printlist (L)




nextupprevious
Next:2.1.1 A Program with List ADTUp:2. ListsPrevious:2. Lists
eEL,CSA_Dept,IISc,Bangalore