一、基本数据结构 1 union m_block 2 { 3 union m_block* next; 4 unsigned int size; 5 }; 6 7 struct m_list 8 { 9 union m_block* free;...
分类:
系统相关 时间:
2014-06-19 07:59:56
阅读次数:
309
二叉树基本操作代码#include "stdafx.h"#include "stdlib.h"#include "string.h"#define MAX 100typedef char Elemtype;typedef struct BTNODE{ Elemtype data; BTN...
分类:
其他好文 时间:
2014-06-19 07:51:41
阅读次数:
251
移动鼠标并显示鼠标坐标struct MOUSE_DEC { unsigned char buf[3], phase; int x, y, btn;}; enable_mouse(&mdec); for (;;) { io_cli(); //...
分类:
其他好文 时间:
2014-06-19 06:55:18
阅读次数:
201
##**问题起源**先看下面很简单的一小段程序。```cpp`#include ```````cpptemplate struct Base { void fun() { std::cout struct Derived : Base{ void gun() { ...
分类:
其他好文 时间:
2014-06-19 06:11:12
阅读次数:
244
#include#include#includeint k,h[110],mark;struct M{ int data; struct M *next;}*head[110];void init(){ int i; for(i = 0; i next = NULL; ...
分类:
其他好文 时间:
2014-06-17 00:58:16
阅读次数:
315
不是BST,那么搜索两节点的LCA就复杂点了,因为节点是无序的。
下面是两种方法,都写进一个类里面了。
当然需要重复搜索的时候,可以使用线段树及多种方法加速搜索。
#include
#include
using namespace std;
class LCANormalTree
{
struct Node
{
int key;
Node *left, *right;...
分类:
其他好文 时间:
2014-06-16 20:20:04
阅读次数:
234
数组构造二叉树并打印本文地址: http://blog.csdn.net/caroline_wendy数组:构造二叉树, 需要使用两个队列(queue), 保存子节点和父节点, 并进行交换;打印二叉树, 需要使用两个队列(queue), 依次打印父节点和子节点, 并进行交换;二叉树的数据结构:struct BinaryTreeNode {
int m_nValue;
BinaryTreeNod...
分类:
其他好文 时间:
2014-06-16 19:45:17
阅读次数:
373
#include
struct BSTNode
{
int m_nval; //数据域
BSTNode *m_pleft; // 左孩子节点
BSTNode *m_pright; //右孩子节点
};
/************************************************************************
功能:在二叉排序树中 查找key值,...
分类:
其他好文 时间:
2014-06-15 12:14:04
阅读次数:
228
#includeusing namespace std;struct date{int year;int month;int day;};struct Person{string name;int age;bool gender;double salary;date birth;Person(){c...
分类:
编程语言 时间:
2014-06-15 10:37:12
阅读次数:
207