![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法与数据结构
狂野之风
这个作者很懒,什么都没留下…
展开
-
二叉树的创建,遍历(前序,中序,后序,层次),查找(C语言)
#include<stdio.h> #include<stdlib.h> typedef struct BiTree { char data; struct BiTree* lchild; struct BiTree* rchild; }BiTree; typedef struct BiQueue { struct BiTree** pBase; int front; int rear; }BQueue; BiTree* CreateBiTree() {原创 2020-10-19 21:48:16 · 196 阅读 · 0 评论 -
汉诺塔问题(C语言)
/* ----汉诺塔C语言实现---- */ #include<stdio.h> void move(char a, char b); void hannuota(int n, char a, char b, char c); void hannuota(int n, char a, char b, char c) { if (n == 1) { move(a, c);//如果只有一个盘子,那么直接从a盘移动到c盘 } else { hannuota(n - 1, a, c原创 2020-10-19 20:53:54 · 129 阅读 · 0 评论 -
简单的单链表(C语言)
代码如下 /* ====链表==== */ #include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node* pNext; }NODE, * PNODE; void init_list(PNODE p) { int n; int i; printf("请输入链表元素的个数:"); scanf_s("%d", &n); for (i = 1; i <=原创 2020-10-19 20:50:13 · 163 阅读 · 0 评论 -
简单的栈结构(C语言)
#include<stdio.h> #include<stdlib.h> //栈 typedef struct Node { int data; struct Node* pNext; }NODE, * PNODE; typedef struct Stack { PNODE pTop; PNODE pBottom; }STACK, * PSTACK; void init(PSTACK pS) { pS->pTop = (PNODE)malloc(sizeof原创 2020-10-19 20:59:53 · 157 阅读 · 0 评论 -
简单的循环队列(C语言)
#include<stdio.h> #include<malloc.h> typedef struct Queue { int* pBase; int front; int rear; }QUEUE; bool full_queue(QUEUE* q) { if ((q->rear + 1) % 6 == q->front) { return true; } else { return false; } } void en_queue(QUE原创 2020-10-19 21:01:28 · 121 阅读 · 0 评论 -
简单的几种排序方法(C语言)
#include <stdio.h> //希尔排序 void shellsort(int a[], int n) { int j; int d = n; while (d > 1) { d = d / 2; for (int x = 0; x < d; x++) { for (int i = x + d; i < n; i = i + d) { int temp = a[i]; for (j = i - d; j > -1 &原创 2020-10-19 20:46:09 · 563 阅读 · 0 评论