1、Definiation
A list is a sequence. a0, a1,a2,..., aN (N>0)
2、Character
For any list except the empty list, we say that Ai follows(or succeeds)Ai-1(i<N) and that Ai-1 precedes Ai(i>0).
3、Operations
(1) LenList(L); // 返回表的长度
(2) GetElem(i, e); // 换值
(3) SearchElem(e, i); // 按值查找
(4) InertElem(i, e); // 插值
(5) DeleteElem(i); // 删值
(1)LenList(L);
LenList(L)
output: 整数类型;
Post-condition: 输出表的长度;
(2) GetElem(L, i);
GetElem(i, e)
Input: 位置参数;
output: e;
Pre-condition: 0<=i<LenList(L);
Post-condition: e被赋予在list的第i个位置;
(3) SearchElem(L, e)
SearchElem(e, i)
intput: e;
output: 位置参数i;
Pre-condition: i<LenList(L);
Post-condition: if e 存在于表中,则输出位置参数,否则输出为0;
(4)InsertElem(i, e)
InsertElem(i, e)
input: 位置i, e;
Pre-condition: 0<=i<LenList(L);
Pos-condition: 在i 的位置插入e;
(5)DeleteElem(i)
DeleteElem(i)
input: 位置参数i;
Pre-condition: 0<=i<LenList(L);
Pos-condition: 删除位置i上的元素;