摘要: 3 #include 4 #include 5 void Swap(int &a, int &b) 6 { 7 int t = a; 8 a = b; 9 b = t; 10 } 11 12 13 //选择排序:交换移动次数少,O(n2) 14 void SelectSort(int a[],int n)//或者int *a... 阅读全文
posted @ 2017-08-28 10:28 心媛意码 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 1 1//代码来自浙大数据结构的讲义 2 #include 3 #include 4 5 typedef struct Node 6 { 7 ElementType Data; 8 struct Node *Next; 9 }List; 10 List L, *ptrL; 11 12 //////////////////////... 阅读全文
posted @ 2017-08-28 10:26 心媛意码 阅读(639) 评论(0) 推荐(0) 编辑
摘要: 1 //代码来自浙大数据结构的讲义 2 #include 3 #include 4 #define MAXSIZE 10 5 6 typedef struct { 7 ElementType Data[MAXSIZE]; 8 int last; //这里的last代表,顺序表最后一个元素的下标,若有n个元素,其值为n-1. MAXSIZE代表表的最大容... 阅读全文
posted @ 2017-08-28 10:23 心媛意码 阅读(206) 评论(0) 推荐(0) 编辑