数据结构
数据结构与算法
Mosquito...
这个作者很懒,什么都没留下…
展开
-
二叉树创建
二叉树创建原创 2022-08-15 11:56:30 · 411 阅读 · 0 评论 -
哈希表代码实现
#include <iostream> #define HASH_SIZE 11 using namespace std; enum{ERROR,OK}; enum{UNSUCCESS,SUCCESS}; enum state{EMPTY,EXIT,DELETE}; using KeyType=string; typedef struct { KeyType key; enum state sign; }NodeSq; typedef struct { NodeSq* elem;原创 2021-07-09 17:07:39 · 321 阅读 · 0 评论 -
链式基数排序
SLList.h #pragma once #ifndef SLLIST_H #define SLLIST_H #include <iostream> #define MAX_NUM_OF_KEY 8 #define MAXSPACE 100 #define RADIX 10 using namespace std; using KeysType = int; using InfoType = int; typedef struct { KeysType keys[MAX_NUM_OF原创 2021-01-22 18:07:28 · 129 阅读 · 0 评论 -
Huffman编码
Huffman.h #pragma once #ifndef HUFFMAN_H #define HUFFMAN_H #define _CRT_SECURE_NO_WARNINGS #pragma warning(push) #pragma warning(disable:6385) #pragma warning(disable:6386) #include <stdio.h> #include <iostream> using namespace std; typedef s原创 2021-01-21 10:56:24 · 174 阅读 · 0 评论 -
递归、非递归遍历二叉树
Stack.h #pragma once #include <iostream> #include "BT.h" #define MaxSize 100 using namespace std; struct SqStack; typedef struct SqStack* Stack; typedef TreeNode* SElemType; struct SqStack { SElemType data[MaxSize]; int top; }; void InitStack(原创 2021-01-20 13:58:26 · 69 阅读 · 0 评论 -
栈的实现cpp
标头.h #include <iostream> #define MaxSize 100 using namespace std; struct SqStack; typedef struct SqStack* Stack; typedef char ElemType; struct SqStack { ElemType data[MaxSize]; int top; }; void InitStack(Stack &s) { /*s = (Stack)malloc(siz原创 2020-11-29 15:49:48 · 231 阅读 · 0 评论 -
判断输入的序列是否为同一棵二叉树
#include <stdio.h> #define Error printf struct TreeNode; typedef struct TreeNode* Tree; typedef int ElementType; void ResetTreeFlag(Tree T); void FreeTree(Tree T); Tree BuildTree(int N); Tree Insert(Tree T, ElementType element); void Print(Tree T);原创 2020-08-22 17:26:01 · 210 阅读 · 0 评论 -
数据结构用数组当作线性表
#include <stdio.h> #define error printf struct List; typedef int ElementType; typedef struct List *List; struct List { ElementType array[100]; int num; }; /*list BuildList() { list list; list->array = malloc(sizeof(ElementType)); list-&g原创 2020-10-27 19:26:48 · 230 阅读 · 0 评论 -
队列的代码实现
//队列的数组实现 #include <stdio.h> #define MaxSize 10 #define error printf struct Quene; typedef struct Queue* Queue; typedef int ElementType; struct Queue { int front; int rear; int size; ElementType Data[MaxSize]; }Q; int IsFullQ(Queue Q) { return原创 2020-08-20 15:13:34 · 499 阅读 · 0 评论 -
带头结点的单链表
#include <stdio.h> #include <stdlib.h> #define error printf struct node; typedef int ElementType; typedef struct node* List; typedef struct node* Node; struct node { ElementType Element; Node Next; }; List Initialize() { List head = (str原创 2020-10-27 19:23:59 · 208 阅读 · 0 评论