摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 using namespace std; 5 6 /*排序用到的结构*/ 7 const int maxSize = 10; 8 typedef struct 9 {10 int r[maxSize+1];11 int length;12 }SqList;13 14 /*数组元素交换*/15 void swap(SqList *L,int i ,int j)16 {17 int temp = L->r[i];18 L->r[i] = L->r[j];19 ... 阅读全文
posted @ 2014-02-16 17:30 CrazyCode. 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 using namespace std; 5 6 /*排序用到的结构*/ 7 const int maxSize = 10; 8 typedef struct 9 {10 int r[maxSize+1];11 int length;12 }SqList;13 14 /*数组元素交换*/15 void swap(SqList *L,int i ,int j)16 {17 int temp = L->r[i];18 L->r[i] = L->r[j];19 ... 阅读全文
posted @ 2014-02-16 16:52 CrazyCode. 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 using namespace std; 5 6 /*散列表查找实现 7 散列表如果没有冲突,查找效率就非常高的.时间复杂度是O(1);但是实际应用中,冲突是不可避免的. 8 那么散列表的平均查找长度取决于 9 1.散列函数是否均匀.10 2.处理冲突的方法.11 3.散列表的装填因子.a = 填入表中的记录个数 / 散列表的长度.当a越大,产生冲突的可能性就越大.12 用空间来换取时间13 */14 const int success = 1;15 const int unSucc 阅读全文
posted @ 2014-02-16 15:56 CrazyCode. 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 #include 5 using namespace std; 6 7 8 /* 9 二叉排序树:又称为二叉查找树,它或者是一棵空树,或者具有如下性质:10 1.若他的左子树不空,则左子树上所有结点的值均小于它的根结点的值.11 2.若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值.12 3.它的左右子树也分别为二叉排序树.13 如中序遍历,则可获得有序序列.14 */15 16 typedef struct BiTNode17 {18 int data;19 st... 阅读全文
posted @ 2014-02-16 15:19 CrazyCode. 阅读(215) 评论(0) 推荐(0) 编辑