C 實現順序表的使用

2021-08-31 03:02:09 字數 593 閱讀 3523

#include

using namespace std;

template

class seqlist 

}seqlist(int length=32)//構造空表

seqlist(int length,int x)//構造順序表

}seqlist(int values,int n )//構造順序表  由values提供元素  n為個數

bool empty()//判斷順序表是否為空

int count()//返回順序表元素個數

void displist()//輸出元素

void insert(t x)//在末尾插入

int serch(t key,int str)//查詢

int remove(int i)//刪除第i個元素

};void main()

;seql.init(xy,10);

seql.displist();

seql.insert(2,9);

seql.displist();

seql.insert(10);

seql.displist();

cout<}

C 順序表的實現

順序表是在計算機記憶體中以陣列的形式儲存的線性表,是指用一組位址連續的儲存單元依次儲存資料元素的線性結構。ifndef list h define list h template class list endif ifndef seqlist h define seqlist h include l...

順序表的c 實現

1 i length 標頭檔案 ifndef orderlist h included define orderlist h included define settype x typedef x elemtype 設定變數型別 typedef struct sqlist void initlist...

順序表(C 實現)

順序表是基本的資料結構,建立seqlist類,主要包括類的預設成員函式 建構函式 析構函式 賦值運算子過載 順序表的基本功能實現。順序表 typedef int datatype class seqlist seqlist 析構函式 深拷貝 seqlist const seqlist s 拷貝建構函...