#include
#include
#include
#define initsize 20
typedef structsqlist;
bool
initlist(sqlist *l);
bool
listinsert(int i,int x,sqlist *l);
bool
listdelete(int i,sqlist *l);
intlocateelem(int x,sqlist *l);
void
listprint(sqlist *l);
void
listrevrse(sqlist *l);
void
deleteelem(sqlist *l);
void
mergelist(sqlist *la,sqlist *lb,sqlist *l);
int main()
bool
initlist(sqlist *l)//構造乙個空的線性表
bool
listinsert(int i,int x,sqlist *l)//插入元素
l->data[j]=x;
l->len++;
return true;
}bool
listdelete(int i,sqlist *l)//刪除元素
intlocateelem(int x,sqlist *l)//查詢元素
}return 0;
}void
listrevrse(sqlist *l)//逆置元素,要求空間複雜度為(1)
}void
deleteelem(sqlist *l)//刪除重複的元素
l->len-=n;
}void
mergelist(sqlist *la,sqlist *lb,sqlist *l)//合併
else
}if(i==la->len)
else
l->len=i+j;
}void
exchangelist(sqlist *l,int m,int n)//將陣列中兩個線性表順序互換
else
}void
listprint(sqlist *l)
printf("length=%d\n",l->len);
}
C語言實現順序表的基本操作
實現了使用c語言完成順序表的插入,排序 氣泡排序 刪除。define maxsize 100 順序表定義 typedef struct sqlist intmain 順序表基本操作 建立順序表 void creatsqlist sqlist l 輸出順序表 void outputsqlist sql...
c語言實現順序表的基本操作
資料結構順序表操作 複製 如下 include include include define list init size 100 define lisincrement 10 define elemtype int define status int typedef struct sqsqlist...
C語言實現順序表基本操作彙總
include include define true 1 define false 0 define ok 1 define error 0 define overflow 2 define list init size 100 define listincrement 10 typedef in...