从有序顺序表中删除所有其值重复的元素,使表中所有元素的值均不同。
bool deletex(List &L){
if(!L.Length) return false;
int i,j;
for(i = 0,j = 1;j < L.Length;j++){
if(L.data[i]!=L.data[j]) L.data[++i] = L.data[j];
}
L.Length = i+1;
return true;
}
从有序顺序表中删除所有其值重复的元素,使表中所有元素的值均不同。
bool deletex(List &L){
if(!L.Length) return false;
int i,j;
for(i = 0,j = 1;j < L.Length;j++){
if(L.data[i]!=L.data[j]) L.data[++i] = L.data[j];
}
L.Length = i+1;
return true;
}