資料結構實驗報
告姓名:wangqiang
學號:051071482
1線性表的應用
#include<>
#include<>
typedef struct nodenode;
node *createlink(int n)
void jose(node *p,int n,int m)
q=p->next;
p->next=q->next;
if(g%5==0)
g++;printf("\n");}
else g++;
printf("%3d:%3dout ",i,q->value-1);
free(q);
}printf("\n");
p->next=null;
}int main( )seqstack;
void initial(seqstack*s);
int isempty(seqstack*s);
int isfull(seqstack*s);
void push(seqstack*s, datatype x);
datatype pop(seqstack*s);
datatype top(seqstack*s);
void printmatchedpairs(char *expr);
void main(void)
//置棧空
void initial(seqstack*s)
//判斷棧是否空
int isempty(seqstack*s)
//判斷棧是否滿
int isfull(seqstack*s)
//進棧
void push(seqstack*s, datatype x)
s-> data[++ s-> top]= x;
return; }
//出棧
datatype pop(seqstack*s)
return s-> data[s-> top--];//棧頂指標加1後將x入棧 }
//取棧頂元素
datatype top(seqstack*s)
return s-> data[s-> top]; }
//括號匹配
void printmatchedpairs(char *expr)
else if(expr[i- 1]== ')')
}while(!isempty(&s))
}3陣列的應用
#include<>
#include<>
sturct tuple3tp /*稀疏矩陣的建立和轉置*/
sturct sparmattp
struct sparmattp a,b;
void crt_sparmat()
}void trans_sparmat()}}
out(struct sparmattp x)
}if(flag==0)printf(" 0");
}printf("\n");}}
main( )
4數和二叉樹的應用
#include <>
#include <>
#define maxsize 100
typedef char datatype;
typedef struct node /*二叉樹結點型別*/
bitree;
bitree *q[maxsize]; /*用於建立二叉樹*/
資料結構實驗報告
實驗報告 實驗課程 資料結構 實驗專案實驗 專業 電腦科學與技術 姓名於凡 學號 10703070328 指導教師汪林林 實驗時間 2008 12 7 重慶工學院計算機學院 實驗一線性表 1.實驗要求 掌握資料結構中線性表的基本概念。熟練掌握線性表的基本操作 建立 插入 刪除 查詢 輸出 求長度及合...
資料結構實驗報告
實驗一線性表的基本操作 1 實驗目的2 2 實驗環境2 3 實驗內容,主要 除錯與執行 2 4 總結14 實驗二棧的基本操作 1 實驗目的15 2 實驗環境15 3 實驗內容,主要 除錯與執行 15 4 總結18 實驗三赫夫曼樹 1 實驗目的18 2 實驗環境18 3 實驗內容,主要 除錯與執行 1...
資料結構實驗報告
實驗題目 計算機與通訊工程學院 2014 實驗一線性表的應用 實驗目的 1 掌握線性表的邏輯結構定義 2 掌握線性表的兩種儲存結構 順序和鏈式 3 掌握順序表和煉表的定義及基本操作 實驗內容 通過程式設計完成具有一定實際意義的課題,加深對線性表應用的理解和掌握。參考題目如下所示。學生可在完成以下題目...