原创 KMP

#include <bits/stdc++.h> using namespace std; int next[] void getnext(char b[]) { int i=0; next[0]=-1; int

原创 數據結構實驗之二叉樹四:(先序中序)還原二叉樹

#include <bits/stdc++.h> using namespace std; typedef struct node { int data; struct node *l,*r; }*tree; t

原创 停車場

#include <bits/stdc++.h> int maxsize; #define addsize 100 #define true 1 #define false 0 typedef long long int elem

原创 小C語言--詞法分析程序

#include <iostream> using namespace std; string S[5]={"keyword","identifier","integer","boundary","operator"}; strin

原创 電影節(並查集)

#include <bits/stdc++.h> using namespace std; int pre[1000000]; int find(int x) // 找到頭 { while(x!=pre[x]) {

原创 二分練習(C++會超時)

#include <bits/stdc++.h> using namespace std; int a[1000100]; int n,m,key,flag; int check(int key) { int low=0;

原创 數據結構實驗之查找五:平方之哈希表

#include <bits/stdc++.h> using namespace std; int main() { int a,b,i,m,d,flag,bb; int has[600]; while(cin>>

原创 數據結構實驗:哈希表

#include <bits/stdc++.h> using namespace std; struct l { int data; int sum; // 記錄次數 }has[100010]; int main() {

原创 數據結構實驗之圖論九:最小生成樹

#include <bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f //定義最大值 int ma[150][150],v[150],dist[150]; int vis

原创 數據結構實驗之圖論十:判斷給定圖是否存在合法拓撲序列(2)

#include <bits/stdc++.h> using namespace std; int ma[20][20]; int dis[20];//存入度 int que[20]; int n,m; void paixu() {

原创 數據結構實驗之查找七:線性之哈希表

#include <bits/stdc++.h> using namespace std; int main() { int a,b,i,m; int has[1100]; while(cin>>a>>b)

原创 小鑫的城堡

#include <bits/stdc++.h> using namespace std; int visit[123456]; int pre[123456]; int find(int x) { while(pre[x]!=

原创 數據結構實驗之圖論十:判斷給定圖是否存在合法拓撲序列

#include <bits/stdc++.h> // 一個圖是否存在合法拓撲序列的充要條件: 有向,無環。 using namespace std; int visit[1100]; int ma[1100][1100]; int q[