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日
摘要: #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) 编辑