原创 字典樹【附加Free例程】

#include <iostream> #include <string.h> using namespace std; #define points 26 struct node; typedef struct node *NumT

原创 Graham算法(計算凸包周長)

struct Point { double x,y; }; Point point[1003]; Point stack[1003];//把構成凸包的點存到stack中,存入點的個數爲top個 int

原创 【用結構體數組完成最小生成樹+並查集】

#include <iostream> #include <cstring> #include <algorithm> using namespace std; typedef struct Line {

原创 棧例程

#include "stdio.h" #include "stdlib.h" #define Element int struct StackRecord; typedef struct StackRecord *Stack; int

原创 二叉查找樹

//二叉查找樹 #include "stdio.h" #include "stdlib.h" #define Type int struct TreeNode; typedef struct TreeNode *SearchTre

原创 圖搜索總結

轉載自:http://blog.csdn.net/urecvbnkuhbh_54245df/article/details/5847876 圖的搜索分類: BFS(廣度優先搜索) 和 DFS(深度優先搜索)         兩

原创 二叉查找樹(AVL形式)

//二叉AVL查找樹 #include "stdio.h" #include "stdlib.h" #include "malloc.h" #define ElementType int struct AvlNode; typede

原创 HDU1232 並查集有趣解說

轉自http://hi.baidu.com/nicker2010/item/9b593c2019c720846f2cc3ee 並做了適當排版 Problem Description   某省調查城鎮交通狀況,得到現有城鎮道路統計表,表中

原创 [STL]next_permutation全排列

四處蒐羅好東西,哈哈 轉載自:http://blog.sina.com.cn/s/blog_9f7ea4390101101u.html 這是一個求一個排序的下一個排列的函數,可以遍歷全排列,要包含頭文件<algorithm> 下面是以前

原创 【Kruskal】算法 最小生成樹

#include <iostream> #include <algorithm> using namespace std; #define MAX 10000 struct edge { int u,v; int price,vis

原创 單雙鏈表的例程(完全版本)

#include "stdio.h" #include "stdlib.h" #include "malloc.h" #define Element int //to adjust Element's type #define turn

原创 POJ 2492[帶權並查集]

A Bug's Life Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 25074   Accepted: 8159 Description Back

原创 鄰接表存圖(出邊表+入邊表)

#include "stdio.h" #include "stdlib.h" #include "string.h" #include "malloc.h" #define MAX 100 struct ArcNode { int

原创 【prim】算法

#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 100000 int map[100][100]; void init(int n) {

原创 隊列例程

#include "stdio.h" #include "stdlib.h" #define Element int struct QueueRecord; typedef struct QueueRecord *Queue; in