数据结构
我真的不是大坏人
酷的像风,野的像狗
展开
-
快排算法
快排算法 #include<iostream> #include<vector> #include<stdlib.h> using namespace std; int partition(vector<int> &vec,int low,int high){ int temp = vec[low]; while(lo...原创 2018-05-22 08:52:43 · 3452 阅读 · 0 评论 -
链表
SList #include&lt;iostream&gt; #include&lt;assert.h&gt; using namespace std; #define ElemType int typedef struct ListNode { ElemType data; struct ListNode *next; }ListNode; typedef ListN...原创 2018-07-28 11:04:11 · 133 阅读 · 0 评论 -
二叉树
头文件 #ifndef __BINTREE_H__ #define __BINTREE_H__ #define ElemType char typedef struct BinTreeNode { ElemType data; BinTreeNode *leftChild; BinTreeNode *rightChild; }BinTreeNode; typede...原创 2018-07-31 20:36:37 · 147 阅读 · 0 评论 -
队列:Queue
逻辑线性结构,先进先出FIFO;队列是两端出入数据,堆栈是单端出入数据; 入队列在队尾,出队列在队首; 头文件 Queue.h #ifndef _QUEUE_H_ #define _QUEUE_H_ typedef unsigned char boolean; #define DEFAULT 10 #define IN 1 #define OUT 0 template<...原创 2018-07-30 12:42:30 · 161 阅读 · 0 评论 -
顺序表2.0
顺序表 头文件: Utili.h #ifndef __UTILI_H__ #define __UTILI_H__ #include<iostream> using namespace std; #endif SeqList.h #ifndef __SEQLIST_H__ #define __SEQLIST_H__ #include"Utili.h" #include&...原创 2018-07-26 15:59:20 · 111 阅读 · 0 评论 -
栈:Stack
头文件 stack.h #ifndef __STACK_H__ #define __STACK_H__ #include&amp;lt;iostream&amp;gt; #include&amp;lt;assert.h&amp;gt; using namespace std; #define ElemType int #define STACK_INIT_SIZE 8 typedef struct Stack { ...原创 2018-07-29 18:54:47 · 243 阅读 · 0 评论 -
链表3.0
双层循环链表 头文件DCList.h #ifndef __DCLIST_H__ #define __DCLIST_H__ #include<iostream> #include<assert.h> using namespace std; #define ElemType int typedef struct ListNode { ElemType d...原创 2018-07-29 14:46:13 · 118 阅读 · 0 评论 -
顺序表
顺序表 这里是头文件 #ifndef _SEQLIST_H #define _SEQLIST_H #include"Utili.h" #include<assert.h> #define ElemType int #define SEQLIST_DEFAULT_SIZE 8 typedef struct SeqList { ElemType *base;//线性表存...原创 2018-05-28 14:41:10 · 229 阅读 · 0 评论 -
二分查找
二分查找 #include<iostream> #include<vector> #include<stdlib.h> #include<stdio.h> using namespace std; int binary_search(vector<int> &vec,int num){ int begin = 0;...原创 2018-05-22 08:56:53 · 128 阅读 · 0 评论 -
BSTree
头文件 BSTree.h #ifndef __BSTREE_H__ #define __BSTREE_H__ #include<iostream> using namespace std; template<class Type> class BSTree; template<class Type> class BSTNode { fri...原创 2018-08-01 16:50:41 · 501 阅读 · 0 评论