- 博客(6)
- 资源 (2)
- 收藏
- 关注
原创 二叉树的创建,遍历(前序,中序,后序,层次),查找(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 217
原创 简单的循环队列(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 148
原创 简单的栈结构(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 200
原创 汉诺塔问题(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 168
原创 简单的单链表(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 182
原创 简单的几种排序方法(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 588
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人