随笔分类 - 数据结构与算法
摘要:#include "stdafx.h"#include <iostream>using namespace std;#define MAXSIZE 20typedef struct{ int r[MAXSIZE + 1]; int length;}SqList;//***********************************起泡排序*************************************beginvoid BubbleSort(SqList& L){ bool flag = false; for (int i = L.leng
阅读全文
摘要:#include "stdafx.h"#include <iostream>using namespace std;//获取next数组的值void GetNext(const char* pattern, int length, int *next){ int i = 0; next[i] = -1; int j = -1; while (i < length - 1) { if (-1 == j || pattern[i] == pattern[j]) { i++; j++; ...
阅读全文
摘要:#include "stdafx.h"#include <iostream>using namespace std;#define MAXSIZE 20typedef struct{ int r[MAXSIZE + 1]; int length;}SqList;typedef SqList HeapType;//***********************************选择排序*************************************begin//查找最小值int SelectMinKey(const SqList& L, i
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; _Node() { data = 0; left = NULL; right = NULL; }}Node, *_PNode;//创建二叉树利用先序创建/* ...
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; bool isVisit; //后序遍历标志(非递归) _Node() { data = 0; left = NULL; right = NULL; isVisit = false; }}...
阅读全文
摘要:#include "stdafx.h"#include <fstream>#include <iostream>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; int bf; //平衡因子 _Node() { data = 0; left = NULL; right = NULL; bf = 0; }}Node, *_PNode;//创...
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <stack>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; _Node() { data = 0; left = NULL; right = NULL; }}Node, *...
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <Windows.h>using namespace std;#define INFINITY 65535#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//*********************************邻接矩阵***********************************begin//邻接矩阵typedef st
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <Windows.h>using namespace std;#define INFINITY 65535#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//*********************************邻接表***********************************begintypedef char Vert
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <Windows.h>#include <algorithm>using namespace std;#define INFINITY INT_MAX#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//********************************Kruskal(并查集实现)*******************
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <stack>#include <Windows.h>using namespace std;#define INFINITY INT_MAX#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//邻接矩阵typedef struct _Graph{ int matrix[MAX_VERTE
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <Windows.h>using namespace std;#define INFINITY INT_MAX#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//邻接矩阵typedef struct _Graph{ int matrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; bool isRed; //红黑树 _Node() { data = 0; left = NULL; right = NULL; isRed = true; }}Node, *_PN...
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <Windows.h>using namespace std;#define INFINITY INT_MAX#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//*********************************邻接表*********************************
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <Windows.h>using namespace std;#define INFINITY INT_MAX#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//邻接矩阵typedef struct _Graph{ int matrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <iomanip>#include <stack>#include <queue>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; int bf; //平衡因子 _Node() { data = 0; left = NULL; ...
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <iomanip>#include <stack>#include <queue>#include <Windows.h>using namespace std;enum TYPE{ TYPE_LINK = 0, TYPE_CLUES,};typedef struct _Node{ int data; struct _Node *left; struct _Node *right; bool isVisit; //用于后序
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <iomanip>#include <stack>#include <queue>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; _Node() { data = 0; left = NULL; right = NULL; }}Node, *_PN
阅读全文
摘要:#include "stdafx.h"#include <iostream>#include <stack>#include <queue>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; bool isVisit; //用于后序非递归遍历,表示节点是否可以访问 _Node() { data = 0; left = NULL; r...
阅读全文
浙公网安备 33010602011771号