
数据结构
文章平均质量分 75
lflfreshlfl
这个作者很懒,什么都没留下…
展开
-
优先队列的使用
http://www.cppblog.com/shyli/archive/2007/04/06/21366.html三种使用方法转载 2011-11-15 15:12:59 · 244 阅读 · 0 评论 -
KMP字符排序
// KMP(模式匹配).cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include using namespace std;int indexsimple(string str1,string str2)//方法一: 简单算法(朴素匹配法),//对一般字符匹配时还可以,但对二进制匹配时时间很大,时间复杂度最原创 2012-03-28 22:00:35 · 495 阅读 · 0 评论 -
paixi
http://www.cnblogs.com/kkun/archive/2011/11/23/2260312.html转载 2012-07-05 21:32:46 · 278 阅读 · 0 评论 -
随机选择算法
http://blog.youkuaiyun.com/cxf7394373/article/details/5621715转载 2015-08-28 10:15:34 · 493 阅读 · 0 评论 -
红黑树
http://blog.youkuaiyun.com/chen19870707/article/details/39585277转载 2015-08-30 11:17:46 · 300 阅读 · 0 评论 -
hash table
http://blog.chinaunix.net/uid-26779539-id-3238274.html转载 2015-08-27 16:35:08 · 375 阅读 · 0 评论 -
动态规划 0/1 背包问题, 最短路径问题
http://blog.youkuaiyun.com/wangran51/article/details/7674832http://blog.youkuaiyun.com/xuefeng0707/article/details/7830469转载 2015-08-31 15:52:48 · 867 阅读 · 0 评论 -
二叉搜索树
用链表来表示, 其中每个节点为一个对象,除了key外,每个节点还包含了属性left, right, p,它们分别指向了结点的左孩子,右孩子和双亲。对任何结点x, 其左子树的所有结点关键字最大不超过x.key, 其右子树的所有结点关键字最小不低于x.key.转载 2015-08-28 21:57:36 · 423 阅读 · 0 评论 -
最大最小值选择 和随机选择
最大最小值选择: 7 void Sort::findMaxMin(int a[], int &max, int &min, int size) 8 { 9 int i = 0; 10 if (size %2) { 11 max = min = a[0]; 12 i = 1; 13 } else { 14 if (a[0转载 2015-09-07 15:31:18 · 504 阅读 · 0 评论 -
基数排序
// sort.cpp : Defines the entry point for the console application.///*基数排序: 对其每一位数进行箱排序digits*(len+range)*/#include "stdafx.h"#include #include#include#includeusing namespace std原创 2012-03-25 15:03:28 · 299 阅读 · 0 评论 -
渴婴问题编程
有一个非常渴的、聪明的小婴儿,她可能得到的东西包括一杯水、一桶牛奶、多罐不同种类的果汁、许多不同的装在瓶子或罐子中的苏打水,即婴儿可得到n 种不同的饮料。根据以前关于这n 种饮料的不同体验,此婴儿知道这其中某些饮料更合自己的胃口,因此,婴儿采取如下方法为每一种饮料赋予一个满意度值:饮用1盎司第i 种饮料,对它作出相对评价,将一个数值si 作为满意度赋予第i 种饮料。 通常,这个婴儿都原创 2012-01-05 21:37:16 · 2026 阅读 · 0 评论 -
STL 中堆、优先队列的使用
1.优先队列 在库#includequeue>中有模板类priority_queue<>2.堆有函数在库中,有make_heap(begin,end)、push_heap(begin,end)、pop_heap(begin,end)、sort_heap(begin,end)函数如int x[11]={87,35,56,48,59,84,42,11,26,66};make_heap(原创 2011-11-16 14:47:11 · 410 阅读 · 0 评论 -
std 中的快速排序
1. qsort 头文件需 #include stdlib.h> #include ,示例来自MSDNvoid qsort( void *base, size_t num, size_t width, int (__cdecl *compare )(const void *, const void *) );// crt_qsort.c/原创 2011-11-16 18:45:07 · 552 阅读 · 0 评论 -
快速排序
// 快速排序.cpp : Defines the entry point for the console application.//以最后一个为基准及以第一个为基准#include "stdafx.h"#include using namespace std;int* partition(int *begin,int *end)//以最后一个参数为基准(pivot){原创 2011-11-16 18:03:17 · 218 阅读 · 0 评论 -
折半归并排序
#include "stdafx.h"#includeusing namespace std;void merge(int array1[], int array2[], int i,int mid, int end){ int k,l,j; for( k=i,l=i,j=mid+1;l { if(array1[l] { arr原创 2011-11-22 20:39:26 · 388 阅读 · 0 评论 -
deque 、向量 、list 比较(zz)
http://hi.baidu.com/shirley_wheat/blog/item/84a3b5f59389eb61dcc47441.html转载 2011-11-08 10:39:00 · 261 阅读 · 0 评论 -
堆排序
特点: 是一颗完全树(每层满的,且最底层的节点在左边);父节点数据均大于(小于)子女节点数据,为最大堆(最小堆)。STL中堆的算法:在库中。算法有:1.make_heap(begin,end)//把从begin至end—1的序列换成堆;2.push_heap(begin,end)//堆插入操作3.pop_heap(begin,end);//堆删除操作,删除第一个元素,保持堆性质原创 2011-11-15 11:13:01 · 260 阅读 · 0 评论 -
图的描述
图表述:G=(V,E),是一个V和E的有限集合,元素V称为顶点(vertice),元素E称为边(edge).用(i,j)来描述一条边,其中i和j是E所连接的两个顶点。 1.有向图----抽象数据类型Graph2.无向图---抽象数据类型Digraph3.加权无向图----抽象数据类型WeightedGraph4.加权有向图----抽象数据类型WeightedDigraph图的描原创 2011-12-29 09:40:42 · 649 阅读 · 0 评论 -
基数排序/计数排序
http://blog.youkuaiyun.com/feixiaoxing/article/details/6876831转载 2015-08-31 17:36:59 · 369 阅读 · 0 评论