教小白精通编程

面向小白的编程教学博客

数据结构-线性查找和二分查找

linear search and ninary search

哈夫曼编码 // copyright by hwdong #include <stdio.h> typedef struct { double weight; int p, l, r; }HNode; typedef struct { HNode *data; int n; }HuffmanTree; void printHuffmanN...

数据结构-栈的应用-迷宫问题

Maze Problem

原理请观看数据结构视频课程的“网易云课堂”和“腾讯课堂” —基于堆栈的迷宫问题代码— #define OK 0 #define ERROR -1 #include <stdio.h> /* int maze[7][7] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0...

数据结构-排序

Sort

排序算法 // copyright by hwdong 插入排序、折半插入排序 #include <stdio.h> typedef int T; /*插入排序*/ void InsertSort(T r[],int n) { for(int i = 1; i <n; i ++) if(r[i]<r[i-1]) { T temp ...

数据结构-栈的应用-表达式求值

Expression Evaluation

表达式求值代码框架,请补充缺失的代码 ——C版本的表达式求值实现———— #include <stdio.h> #include <malloc.h> #define OK 0 #define ERROR 1 /*----------字符栈--------*/ typedef char EType; typedef struct{ EType *dat...

数据结构-字符串

String

字符串的实现示例: //------------------string.h--------------- typedef struct{ char *s; int _size; }String; bool initString(String &s,char *s0); void destoryString(String &s); void clea...

数据结构-多维数组

Array

原理请观看数据结构视频课程的“网易云课堂”和“腾讯课堂” —多维数组(Multi Dimensional Array)的C版本实现— /*-----------Array.h-------------*/ typedef double ElemType; typedef struct{ ElemType *base;//存储数据元素的空间地址 int dim; ...

数据结构-图的创建和Dijkstra最短路径算法

Graph Creation and Dijkstra Algorithm

原理请观看数据结构视频课程的“网易云课堂”和“腾讯课堂” —图的创建和Dijkstra最短路径算法–C语言版本– #include <stdio.h> #include <malloc.h> #define OK 0 #define ERROR 1 typedef char VType; typedef double WeightType; typede...

数据结构-哈希表Hash Table

Hash Table

原理请观看数据结构视频课程的“网易云课堂”和“腾讯课堂” 哈希表Hash Table C版本 // copyright by hwdong #include <stdio.h> #include <stdlib.h> #define SIZE 119 #define OK 0 #define ERROR 1 typedef int KeyType; t...

数据结构-哈夫曼编码

Huffman Coding

原理请观看数据结构视频课程的“网易云课堂”和“腾讯课堂” 哈夫曼编码 // copyright by hwdong #include <stdio.h> typedef struct { double weight; int p, l, r; }HNode; typedef struct { HNode *data; int n; }Huf...

数据结构-二叉树

Binary Tree

手工创建二叉树 // copyright by hwdong #include <stdio.h> #include <malloc.h> typedef char EType; typedef struct binode{ EType data; struct binode *lchild,*rchild; }BiNode; BiNode *n...