按先序序列输入字符序列(其中逗号表示空节点),输出该二叉树的层次遍历序列。
#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
1.链队列结构
typedef struct QNode /* 结点结构 */
{
QElemType data;
struct QNode *next;
}QNode,*QueuePtr;
typedef struct /* 队列的链表结构 */
{
QueuePtr front,rear; /* 队头、队尾指针 */
}LinkQueue;...
分类:
编程语言 时间:
2014-05-25 10:25:15
阅读次数:
325
哈希表简单实现,练个手
#include "stdafx.h"
#include
using namespace std;
#define HASHSIZE 12
typedef struct HashTable
{
int *elem;
int count;
}HashTable;
int m = 0;
void Print(HashTable* ...
分类:
其他好文 时间:
2014-05-25 07:02:06
阅读次数:
169
很少用bfs进行最短路搜索,实际BFS有时候挺方便得,省去了建图以及复杂度也降低了O(N*M);UVA 11624 写的比较挫#include #include
#include #include using namespace std;struct node{ int ft; int ...
分类:
其他好文 时间:
2014-05-25 03:23:54
阅读次数:
210
说明:
******不同的编译器和处理器,其结构体内部的成员有不同的对齐方式。
******使用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
只是实现了链表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