标签:
The previous examples are just let us get used to link list, but in practice we don‘t just use link list to input and show the data, in other word there are functions we can implement to link list and make it more powerful.
Here is an ADT definiton to link list:
ADT LinkList
Data
instances ordered finite collections of zero or more elements
Operations
Initial(*L): Initialize to create an empty link list L
IsEmpty(L): Return whether the list is empty
Clear(*L): Clear list L to make it empty
GetElem(L, i, *e): Get the ith element in list L, return it to e
HasElem(L, e): Return true if found e in list L, otherwise return false
Insert(*L, i ,e): Insert element e in the position i of list L
Delete(*L, i, *e): Delete the ith element e, and return e
Length(L); Return number of elements in list L
endADT
SinglyLinkList 3 -- What are we going to do?
标签:
原文地址:http://www.cnblogs.com/Aegis-Liang/p/4792575.html