数据结构学习
lengshien
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
根据二叉树的前序和中序建树
#ifndef BINARYTREE_H #define BINARYTREE_H #include struct BinaryTreeNode { int m_nValue; BinaryTreeNode* m_nLeft; BinaryTreeNode* m_nRight; }; BinaryTreeNode* CreatBinaryTre原创 2017-05-13 16:12:48 · 650 阅读 · 0 评论 -
快速排序 C++
讲解建议大家直接看算法导论 #include using namespace std; int Partition(int a[],int,int); void QuickSort(int a[],int,int); int main() { int a[10] = {1,2,4,56,25,1,33,6,77,1}; int len = sizeof(a)/sizeof(int原创 2017-05-12 07:48:43 · 473 阅读 · 0 评论 -
数据结构学习 链表的建立
数据结构学习 链表的建立原创 2015-11-11 19:39:57 · 498 阅读 · 0 评论 -
素数打表
一种常见的素数打表的方法 void init_prime() { int i, j; for(i = 2;i <= sqrt(1000002.0); ++i) { if(!prime[i]) for(j = i * i; j < 1000002; j += i) prime[j] = 1; } j = 0; for(i = 2;i <= 1000002; ++i)原创 2015-08-20 09:39:13 · 341 阅读 · 0 评论 -
dfs模板
DFS: /* 该DFS 框架以2D 坐标范围为例,来体现DFS 算法的实现思想。 */ #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; const int maxn=100; bool vst[maxn][maxn]; // 访问标记 int map[maxn][maxn]; // 坐标范围 int原创 2015-08-11 10:29:34 · 592 阅读 · 0 评论 -
bfs模板
#include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; const int maxn=100; bool vst[maxn][maxn]; // 访问标记 int dir[4][2]={0,1,0,-1,1,0,-1,0}; // 方向向量struct State // B原创 2015-08-11 10:28:21 · 419 阅读 · 0 评论
分享