//线性表的一个例子 #include<iostream> using namespace std; typedef struct List { int num; struct List *next;//指向下一个元素 }list,*listp;//前者代表该种数据类型,后者代表该种数据类型的指针 void InitList(listp &first) {
最近在复习数据结构,顺便看看大一的时候写的代码,看完之后比当初有了更加深刻的体会。 /* 将递增数组a[m],递减数组b[n],归并为有序递增数组c[m+n]*/void sort (int *a, int *b, int m, int n){int i, j, k = 0;int c[m+n];i = 0;j = n -1;while (i < m && j >= 0){if (a[i++
2.1、线性表的定义和基本操作 如有侵权请联系删除。 2.1.1、线性表的定义: 线性表是具有相同数据类型的 n (n>=0) 个数据元素的有限序列,其中 n 为表长,当 n = 0 时线性表是一个空表。若用 L 命名线性表,则其一般表示为: L = ( a 1 , a 2 , a 3 , . . . , a i , x i + 1 , . . . , a n ) L=(a_1,a_2
转载 #include <iostream> using namespace std; typedef int element; #define maxsize 100 typedef struct { element aa[maxsize]; int last; }sqlist; int compare(sqlist *la,int x)