会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
tomctx
tomctx
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
2012年4月7日
分治法-求最大最小元
摘要: 用分治法求n个元素集合S中的最大、最小元素(要求每次平分成2个子集)void maxmin(int A[], int &e_max, int &e_min ,int low, int high) { int mid, x1, y1, x2, y2; if (high - low <= 1) { //<=,可能为1个 if (A[high] > A[low]) { e_max = A[high]; e_min = A[low]; } else { ...
阅读全文
posted @ 2012-04-07 13:16 tomctx
阅读(934)
评论(0)
推荐(0)
编辑
2012年2月20日
《数据结构Chapter10·内部排序》
摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#define MAXSIZE 20typedef int Keytype;typedef struct{ Keytype key;// char *otherinfo;}Redtype;typedef struct{ Redtype r[MAXSIZE + 1]; int length;}SqList;//int a, b;#define EQ(a, b) ((a) == (b))#define LT(a, b) ((a) < (b))#defi
阅读全文
posted @ 2012-02-20 09:40 tomctx
阅读(166)
评论(0)
推荐(0)
编辑
上一页
1
2