CodeOfDataStructure
fktr_70
Talk is cheap,show me code.
展开
-
AVL树--C语言实现
avltree.h#ifndef _AVLTREE_H_#define _AVLTREE_H_struct AvlNode;typedef struct AvlNode* Position;typedef struct AvlNode* AvlTree;typedef int ElementType;AvlTree Insert(ElementType x, AvlTree T);Avl原创 2015-12-30 00:36:43 · 364 阅读 · 0 评论 -
开放定址散列表--C语言实现
hashtable.h#ifndef _HASHTABLE_H_#define _HASHTABLE_H_#define MinTableSize 10000#define Prime 10007typedef unsigned int Index;typedef Index Position;struct HashTbl;typedef struct HashTbl* HashTabl原创 2015-12-30 21:38:55 · 367 阅读 · 0 评论 -
二项队列--C语言实现
binqueue.h#ifndef _BINQUEUE_H_#define _BINQUEUE_H_#define MaxTrees 100#define Capacity 1000struct BinNode;struct Collection;typedef int ElementType;typedef struct BinNode *Position;typedef Posit原创 2016-01-01 17:24:52 · 652 阅读 · 0 评论 -
二叉堆--C语言实现
binheap.h#ifndef _BINHEAP_H_#define _BINHEAP_H_#define MinPQSize 100struct HeapStruct;typedef int ElementType;typedef struct HeapStruct *PriorityQueue;PriorityQueue Initialize(int MaxElements);vo原创 2015-12-31 14:59:45 · 555 阅读 · 0 评论 -
左式堆--C语言实现
leftheap.h#ifndef _LEFTHEAP_H_#define _LEFTHEAP_H_#define Insert(X,H) (H=Insert1((X),H))#define DeleteMin(H)(H=DeleteMin1(H))struct TreeNode;typedef struct TreeNode *PriorityQueue;typedef int Elem原创 2016-01-01 11:03:22 · 787 阅读 · 1 评论 -
斜堆--C语言实现
skewheap.h#ifndef _SKEWHEAP_H_#define _SKEWHEAP_H_#define Insert(X,H) (H=Insert((X),H))struct TreeNode;typedef struct TreeNode *PriorityQueue;typedef int ElementType;PriorityQueue Initialize();Ele原创 2016-01-01 12:41:29 · 392 阅读 · 0 评论 -
分离链接散列表--C语言实现
hashtable.h#ifndef _HASHTABLE_H_#define _HASHTABLE_H_#define MinTableSize 100#define Prime 10007struct ListNode;typedef struct ListNode* Position;struct HashTbl;typedef struct HashTbl* HashTable;原创 2015-12-30 18:07:39 · 481 阅读 · 0 评论 -
静态链表--C语言实现
list.h#ifndef _LIST_H_#define _LIST_H_#define SpaceSize 100typedef int PtrToNode;typedef PtrToNode List;typedef PtrToNode Position;typedef int ElementType;int IsEmpty(const List L);int IsLast(con原创 2015-12-30 11:38:41 · 348 阅读 · 0 评论 -
List--C++模板类
#ifndef _PACKAGE_H_#define _PACKAGE_H_//数组实现namespace list_in_array{ template<typename T> class List { private: enum { bad = -1 }; enum { MAX = 100 }; T elem原创 2015-12-30 12:29:17 · 266 阅读 · 0 评论 -
Stack链表C实现
stack.h#ifndef STACK_H_#define STACK_H_struct Node;typedef struct Node * PtrToNode;typedef PtrToNode Stack;typedef int ElementType;int IsEmpty(Stack S);Stack CreateStack();void MakeEmpty(Stack S)原创 2015-12-30 12:13:12 · 366 阅读 · 0 评论 -
Stack--C++模板类
#ifndef _STACK_H_#define _STACK_H_//数组实现namespace stack_in_array{ template <typename T> class Stack { private: enum { MAX = 100 }; T elements[MAX]; int top;原创 2015-12-30 12:23:56 · 285 阅读 · 0 评论 -
Queue--C++模板类
#ifndef _PACKAGE_H_#define _PACKAGE_H_//链表实现namespace queue_in_list{ template<typename T> class Queue { private: struct Node { T data; struct原创 2015-12-30 12:25:48 · 374 阅读 · 0 评论 -
动态链表--C语言实现
list.h#ifndef _LIST_H_#define _LIST_H_struct Node;typedef int ElementType;typedef struct Node *PtrToNode;typedef PtrToNode List;typedef PtrToNode Position;List MakeEmpty(List L);int IsEmpty(List原创 2015-12-30 11:03:25 · 376 阅读 · 0 评论 -
BST树--C语言实现
bsttree.h#ifndef _BSTTREE_H_#define _BSTTREE_H_struct BstNode;typedef int ElementType;typedef struct BstNode *Position;typedef struct BstNode *BstTree;BstTree MakeEmpty(BstTree T);Position Find(E原创 2015-12-30 01:40:27 · 652 阅读 · 0 评论 -
不相交集--C语言实现
disjset.h#ifndef _DisjSet_H_#define _DisjSet_H_#define NumSets 100typedef int DisjSet[NumSets + 1];typedef int SetType;typedef int ElementType;void Initialize(DisjSet S);void SetUnion(DisjSet S, S原创 2016-01-03 21:47:24 · 465 阅读 · 0 评论