- 博客(21)
- 资源 (22)
- 收藏
- 关注
原创 队列和堆栈实现二叉树的遍历
#include#include #include using namespace std;typedef struct node{//二叉树节点 int value; node *left; node *right;}node,*pnode;typedef struct list{//队列的基本结构 pnode pn; list *next;}list,*plist;
2014-01-29 10:23:20 1215
原创 算法导论10.2-8-用一个整数地址替代前后指针实现双向链表
#include#include #include using namespace std;typedef struct dlist{//双向链表 int value;//存储值 unsigned int np;//存储地址值}dlist, *pdlist;void insert(pdlist &d,pdlist cur)//双链表插入元素{ d->np^=(unsigne
2014-01-26 14:32:00 1069
原创 双向链表插入删除
#include#include #include using namespace std;typedef struct dlist{//双向链表 int value; dlist *next; dlist *prev;}dlist, *pdlist;void insert(pdlist &d,pdlist cur)//双链表插入元素{ if(!d){ d=cur;
2014-01-24 19:32:05 687
原创 单链表逆转
#include#include #include using namespace std;typedef struct list{//用链表实现堆栈 int value; list *next;}list, *plist;void insert_s_n(plist &l,plist node)//向链表中添加元素-堆栈顺序-不带头结点{ if(!l){ l=node;
2014-01-24 15:33:01 698
原创 单链表实现队列
#include#include #include using namespace std;typedef struct list{//用链表实现队列 int value; list *next;}list, *plist;typedef struct queue{//队列 plist head; plist tail;}queue,*pqueue;void enqu
2014-01-23 22:12:41 836
原创 算法导论10.1-5-双端队列
#include #include #include using namespace std;typedef struct deque{//队列 int a[10]; int head; int tail;}deque,*pdeque;void init(pdeque q)//初始化{ q->head=0; q->tail=0;}void endeque(pdeq
2014-01-23 12:38:30 948
原创 两个队列模拟一个堆栈
#include #include #include using namespace std;typedef struct queue{//队列 int a[10]; int head; int tail;}queue,*pqueue;void init(pqueue q)//初始化{ q->head=0; q->tail=0;}void enqueue(pque
2014-01-23 10:08:10 839
原创 进出队列(含上溢,下溢处理)
#include #include #include using namespace std;typedef struct queue{//队列 int a[10]; int head; int tail;}queue,*pqueue;void init(pqueue q)//初始化{ q->head=0; q->tail=0;}void enqueue(pque
2014-01-22 18:58:51 2869
原创 算法导论9-2-c-带权中位数
#include #include #include #include using namespace boost::timer;using namespace std;int partition(double *a,int low,int high){ double key=a[high]; int p=low-1; double tmp; for(int i=low;i
2014-01-18 21:02:29 1752 1
原创 算法导论9.3-8-设X[1..n]和Y[1..n]为两个数组,每个都包含n个已排好序的数,给出一个求数组X和数组Y中所有2n个元素的中位数
#include #include #include #include using namespace boost::timer;using namespace std;int partition(int *a,int low,int high){ int key=a[high]; int p=low-1; int tmp; for(int i=low;i<high;++i
2014-01-16 16:46:52 4676
原创 k分位数
#include #include #include using namespace boost::timer;using namespace std;int partition(int *a,int low,int high){ int key=a[high]; int p=low-1; int tmp; for(int i=low;i<high;++i){ if(a[
2014-01-15 19:49:48 1591
原创 利用中位数进行快速排序
#include #include #include using namespace boost::timer;using namespace std;int partition(int *a,int low,int high)//快速排序分割{ int key=a[high]; int p=low-1; int tmp; for(int i=low;i<high;++i){
2014-01-14 21:23:56 958
原创 算法导论8-5-平均排序-k排序
#include #include #include using namespace std;using namespace boost::timer;void quick_k_sort_partition(int *a,int low,int high,int interval)//借用快速排序排列某种元素{ if(low<high){ int key=a[low];
2014-01-11 21:36:46 1446
原创 算法导论8-3变长数据项排序-整数数组-字符串
//算法导论8-3,变长数据项的排序#include #include #include using namespace std;using namespace boost::timer;int bits(int i)//找出每位数的位数,正数为正,负数为负{ int radix=1; while (i/10) { radix++; i/=10; } return
2014-01-09 10:39:16 1552
原创 算法导论8.4-4-单位圆中均匀分布情况--桶排序
#include #include using namespace std;typedef struct point_circle//圆内点的数据结构{ double x,y;//x,y坐标 double r; //半径}point_circle, *ppoint_circle;typedef struct node{//桶数据结构 point_circle *valu
2014-01-08 13:32:22 2601 1
转载 如何平均得到圆内点的随机分布
今年某公司的笔试题目还蛮有意思的,原题不还没见到,不过经过一系列变化之后,可以等价地表述为如下:如何利用一个能够返回平均随机点的函数,等概率地生成一个单位圆中的点,使得生成地点在圆内的分布概率尽量平均,即在面积上平均分布。首先,要弄明白之间的平均随机是指什么;其次,还需要搞清楚在面积上平均分布是指什么。下面两个图分别是平均随机和正态随机的分布情形:
2014-01-07 21:02:08 6381 1
原创 计数排序,基数排序,桶排序和快速排序算法时间对比
//基数排序#include #include #include using namespace boost::timer;using namespace std;void find_max_min(int *a,int &max,int &min,int n){ max=a[0],min=a[0];//寻找最大最小值 for(int i=1;i<n;++i){ if(ma
2014-01-07 09:55:34 1205
原创 算法导论-6.5-9 使用最小堆完成k路归并算法
//基于最小堆的K路归并算法#include #include #include using namespace std;typedef struct node{ int value; node *next;}node,*pNode;void insert_node(node *head, node *nenode)//直接插入法,插入新节点{ node *cur=hea
2014-01-05 15:05:27 2223 1
原创 杨氏矩阵
#include#include #include using namespace std;void young_tableau(int **a,int i,int j,int m,int n)//维护杨氏矩阵{ int min_row=i,min_col=j; if(i+1a[i+1][j])){//比较当前元素与下边元素值的大小 min_row=i+1; } if(i<
2014-01-05 10:16:03 815
原创 两种快速排序
#include #include #include #include using namespace boost::timer;using namespace std;void same_elem_quick_sort(int *a,int low,int high)//考虑相同元素的情况{ if(low<high){ int pivot=a[low]; int i=
2014-01-05 10:14:55 579
原创 堆排序
#include #include #include using namespace std;void max_heapify(int *a,int i,int heap_size)//维护最大堆{ while (i<=heap_size/2) { int left=2*i+1,right=2*i+2; int largest=i; if(lefta[i]) la
2014-01-03 10:41:52 577
Speech Recognition Algorithms Using Weighted Finite-State Transducers
2018-06-24
H264中CAVLC的FFmpeg实现
2016-12-04
H264/AVC中CAVLC的FFmpeg实现
2016-12-04
VisualGDB调试Android JNI和Linux项目
2016-05-08
YUVviewer-HEVC
2013-05-25
基于OPENCV的超声图像增强
2012-05-17
编译原理 词法分析 。。。。。。。。。。。
2011-06-08
都市行 公交查询 j2me
2010-05-08
深入浅出Android--Google手持设备应用程序设计.pdf
2010-05-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人