Let L be a list of
type T where p indicates the position of the element then list can be defined
as an ADT as follows:
·
create(L): Create an empty list L.
·
insert(L,x,p): Insert the element ‘x’ in the p position of
the list L, if ‘p’ is valid.
·
find(x,
L): search the element ‘x’
from the list L. Return ‘p’ if the element ‘x’ is found otherwise -1.
·
display(L,
p): Display the element of list
L in the position ‘p’, if ‘p’ is a valid position.
·
delete(L,
p): delete the element of list
L in the position ‘p’ if ‘p’ is valid position.
·
print(L): Display all the element of list L if it is not
empty.
·
sort(L): Sort the elements of the list in some definite
order.
No comments:
Post a Comment