设线性表的
n
个结点定义为(
a0,a1,…,an-1
),在顺序表上实现的插入和删除算法如下,请在空白处填入适当内容。
(
顺序表的最大可容纳项数为
MaxSize)
Template <class Type> int SeqList<Type>::Insert(Type &x, int i) { If (i<0 || i>last+1 || last==1) return 0; Else { Last++; For(int j=last;j>i;j--) data[j]=2; 3; Return 1; } } Template <class Type> int seqList<Type>::Remove(Type &x){ int i=Find(x); if(i>=0) { last--; for (int j=4;j<=last;j++) data[j]=5; return 1; } return 0; }