一些常用的数据结构(一):线性表
十一期间没事,继续复习数据结构:
线性表(或称为顺序表)。优点:查找方便,缺点:占用空间。
结构如下:
?
LinearList* LinearList::Insert(int pos,int x){if(pos>length||pos<0)//throw something; if(length>=MaxSize) //throw something;for(int i=length;i>=pos;i--){element[i]=element[i-1];}element[pos]=x;length++;return *this;}?
?
?
??