按先序序列输入字符序列(其中逗号表示空节点),输出该二叉树的层次遍历序列。
#include
#define END ','//表示空节点
using namespace std;
typedef char Elem_Type;
typedef struct BiTree
{
Elem_Type data;
struct BiTree *Lchild;
stru...
分类:
其他好文 时间:
2014-05-26 04:53:07
阅读次数:
261
这两天学习了网络流,下面是ISAP算法模板:
const int inf = 0x3fffffff;
template
struct Isap
{
int top;
int d[N], pre[N], cur[N], gap[N];
struct Vertex{
int head;
} V[N];
struct Edge{...
分类:
其他好文 时间:
2014-05-26 04:10:16
阅读次数:
252
1 #include 2 using namespace std; 3 template 4
class Queue 5 { 6 private: 7 struct node 8 { 9 T data;10 node * next;11 ...
分类:
其他好文 时间:
2014-05-26 02:19:36
阅读次数:
213
http://acm.hdu.edu.cn/showproblem.php?pid=1086跨立实验算法#include#include#include#includeusing
namespace std;struct Point{ double x,y;} ;struct Line{ ...
分类:
其他好文 时间:
2014-05-26 02:10:52
阅读次数:
224
说明:
******不同的编译器和处理器,其结构体内部的成员有不同的对齐方式。
******使用sizeof()运算符计算结构体的长度。
###结构体中每个成员相对于结构首地址的偏移量都是成员大小的整数倍,如果有需要编译器会在成员之间加上填充字。
###结构体的总大小是结构体最宽基本类型成员大小的整数倍。如果需要编译器会在最后一个成员之后加上填充字。
struct A
{ unsigne...
分类:
编程语言 时间:
2014-05-25 00:40:40
阅读次数:
314
#include
#define maxn 1000;
//队列ADT---数组实现
struct queueRecord;
typedef struct queueRecord *Queue;
typedef int elementType;
int isEmpty(Queue Q);
int isFull(Queue Q);
Queue creatQueue(int maxn);
voi...
分类:
其他好文 时间:
2014-05-24 23:22:16
阅读次数:
368
题目链接:点击打开链接
题意:有两种操作,合并集合,查询第K大集合的元素个数。(总操作次数为2*10^5)
Treap模板(静态数组)
#include
#include
#include
#include
#include
const int maxNode = 500000 + 100;
const int inf = 0x3f3f3f3f;
struct Tr...
分类:
其他好文 时间:
2014-05-24 23:18:09
阅读次数:
522
只是实现了链表ADT的部分功能。
/*---编写打印出一个单链表的所有元素的程序---*/
#include
#include
struct Node{
int val;
struct Node *next;
};
Node *findEnd(Node *list){
while(list->next) list = list->next;
return list;
}
v...
分类:
其他好文 时间:
2014-05-24 22:30:37
阅读次数:
232
#include
#include
#include //system(); 这个指令需要用到此头文件
#include //toupper要用到
#include //在内存管理时用到的头文件
void main()
{
int i;
struct ListEntry{
int number; //数据域
struct ListEntry *next; //指向 下...
分类:
其他好文 时间:
2014-05-24 18:15:27
阅读次数:
258
/*---给你一个链表L和另一个链表P,它们包含以升序排列的整数。操作PrintLots(L,P)
将打印L中那些由P所指定位置上的元素。---*/
#include
#include
struct Node{
int val;
struct Node *next;
};
Node *findEnd(Node *list){
while(list->next) list = l...
分类:
其他好文 时间:
2014-05-24 14:27:42
阅读次数:
224