08 2007 档案
摘要:/**//*书上采用的是更现实的非递归算法,但是我参考了几本书都是采用的递归算法,并且书上的非递归算法也没有太细的讲(可能是我太笨吧),总之没有学明白.唉 :(这里采用的是严蔚敏版的递归算法,且在这本书中,也有提示说递归算法在实际应用中不可取,因为在MSort要重复的定义很多的list,需要很多的栈空间自考书中的算法只需要定义一个list.我也纳闷了,连正规的本科讲的归并都是采用的递归算法,为什...
阅读全文
摘要:/**//*这个算法的实现没有按照书上的做法,书的算法变量太多,且命名混乱,不容易分析和理解,所以我采用了严蔚敏版的算法.另外,书中在排序开始时是讲,所有的排序都是从小到大的排序,但现在的做法是将小的结点放在了数组的后面,又没有说明.*/#include "stdafx.h"#include #include int const count=8;typedef struct { int ke...
阅读全文
摘要:#include "stdafx.h"#include #include int const count=8;typedef struct { int key;}records;typedef records list[count+1];void select(list & r){ for(int i=1;i>r[i+1].key; } */ r[1].key=70;...
阅读全文
摘要:#include "stdafx.h"#include #include int const count=8;typedef struct { int key;}records;typedef records list[count+1];//此处没有使用书中的算法,书中的算法实现很繁索,且使用i,h,j,p,x一类的变量,使程序阅读更加吃力//我实现的是严蔚敏版的数据结构中关于快速排序的算法...
阅读全文
摘要:#include "stdafx.h"#include #include int const count=10;typedef struct { int key;}records;typedef records list[count+1];void BubbleSort(list & r){ bool flag=1; //最多需要比较n-1次 for(int i=1;ir[...
阅读全文
摘要:#include "stdafx.h"#include #include int const count=10;typedef struct { int key;}records;typedef records list[count+1];void straightsort(list & r){ for(int i=2;i>r[i+1].key; } cout<<"输入的序...
阅读全文
摘要:#include "stdafx.h"#include #include typedef struct btnode * bitreptr;struct btnode{ int data; //数据 bitreptr lchild; //左节点指针 bitreptr rchild; //右节点指针}...
阅读全文
摘要:#include "stdafx.h"#include #include //顺序表上的查找int const maxsize=10;typedef struct{ int key;}rec;typedef struct{ rec item[maxsize+1]; int n; //最后一个元素下标}sqtable;int search_sqtabl...
阅读全文