#include
#include
#include
using namespace std;
#define INFINITY DBL_MAX //无穷大
#define MAX_VERTEX_NUM 20 //最大顶点个数
enum GraphKind //图的类型
{
DG,DN,UDG,UDN//有向图、有向网、无向图、无向网
};
//弧结构
typedef struct...
分类:
其他好文 时间:
2014-06-07 01:52:18
阅读次数:
214
直接上代码:
/*
二叉树的链表实现:
以及三种遍历方式:
author:天下无双
Date:2014-5-28
Version:2.0
*/
#include
#include
typedef int T;//树内节点的数据类型
using namespace std;
class BiTree
{
private:
struct BiNode{
T data;
BiN...
分类:
其他好文 时间:
2014-06-05 06:30:49
阅读次数:
273
自然对齐:
1.一个基本类型实例的大小要能整除其地址值。
2.数组有着和数组里类型本身相同的对齐要求。
3.一个聚集类型的实例,其对齐要求最严格的子类型的排列要能整除聚集的地址
在32位机器上,
char的大小为1(以字节计),所以它可以被存储在内存的任意地址处
short的大小为2,所以它只能存储在“偶数”地址处
integer和指针的大小为4(32位机上一个字为4个字节),所以它们只能存储在一个字界中
double的大小为8,所以它只能存储在两个字界中...
分类:
其他好文 时间:
2014-06-05 03:52:15
阅读次数:
200
题目:
链接:点击打开链接
题意:
中文题
算法:
思路:
赤裸裸的最小生成树。。
代码:
#include
#include
using namespace std;
struct node{
int u,v,w;
} e[110];
int p[110];
int n,m,sum,ans;
int cmp(node...
分类:
其他好文 时间:
2014-06-05 03:50:23
阅读次数:
232
DP求解。对Blocks的先按照X降级,再按照Y降级排序,可以转化为最长公共子序列问题,即求子序列权值之和最大。
#include
#include
#include
using namespace std;
#define MAX_SIZE 300
struct Block{
int x;
int y;
int height;
};
int nums...
分类:
其他好文 时间:
2014-06-03 04:39:44
阅读次数:
223
typedef char status;
typedef char Telemtype;
#define NULL 0
#define OK 1
typedef struct bitnode{
Telemtype data;
struct bitnode *lchild,*rchild;
}bitnode,*bitree;
Creatbitree(bitree &t)
{
//先序创建二叉...
分类:
其他好文 时间:
2014-06-03 00:47:39
阅读次数:
195
最近在做uboot中nand启动相关的工作,遇到一个问题一直纠结着。现在终于明白了这个问题,想想还有好多兄弟在某个黑暗的角落里或者某台电脑前纠结着呢,所以赶紧写下来以供查阅。
uboot version 2014.4
/* Architecture-specific global data */
struct arch_global_data {
#if defined(CONFIG_FS...
分类:
其他好文 时间:
2014-06-01 10:27:38
阅读次数:
314
/*
**AVL平衡树插入例程
**2014-5-30 11:44:50
*/
avlTree insert(elementType X, avlTree T){
if(T == NULL){
T = malloc(sizeof(struct avlTree));
if(T == NULL) fatalError("Out of space!!!");
T->element = X...
分类:
其他好文 时间:
2014-06-01 09:50:16
阅读次数:
233
哈希表的链地址法来解决冲突问题将所有关键字为同义词的记录存储在同一个线性链表中,假设某哈希函数产生的哈希地址在区间[0, m -
1]上,则设立一个至振兴向量Chain ChainHash[m];数据结构//链表结点typedef struct _tagNode{ int data;
...
分类:
其他好文 时间:
2014-05-31 19:23:52
阅读次数:
436