
数据结构与算法学习历程
文章平均质量分 88
37.20 ℃
这个作者很懒,什么都没留下…
展开
-
利用栈实现二进制数转化成十进制数
利用栈实现二进制数转化成十进制数#include "stdio.h"#include "stdlib.h"#include "math.h"#define OK 1#define ERROR 0#define STACK_INIT_DATA 20#define STACKINCREMENT 10typedef char Elemtype;typedef int St...原创 2019-08-03 21:02:35 · 484 阅读 · 0 评论 -
创建并通过中序遍历线索化一颗二叉树
创建并线索化一颗二叉树#include "stdio.h"#include "stdlib.h"typedef char Elemtype ;typedef enum{Link,Thread} PointerTag;typedef struct BiTNode{ Elemtype data; struct BiTNode *lchild; struct BiTNode *rchil...原创 2019-08-13 22:28:35 · 346 阅读 · 0 评论 -
用递归实现汉诺塔
用递归实现汉诺塔#include "stdio.h"void move(int n,char x,char y,char z){ if(n==1){ printf("%c->%c\n",x,z); } else{ move(n-1,x,z,y); printf("%c->%c\n",x,z); move(n-1,y,x,z); }}void main(...原创 2019-08-05 21:47:48 · 433 阅读 · 0 评论 -
利用递归实现斐波那契数列
利用递归实现斐波那契数列#include "stdio.h"int Fib(int i){ if(i<2) return i=0?0:1; else return Fib(i-2)+Fib(i-1);}int main(){ int i; printf("请输入要实现的递归次数:"); scanf("%d",&i); printf("\n最后的结果为:%d...原创 2019-08-05 21:17:54 · 1039 阅读 · 0 评论 -
利用栈实现中缀表达式转换成后缀表达式
利用栈实现中缀表达式转换成后缀表达式#include "stdio.h"#include "stdlib.h"#include "math.h"#define OK 1#define ERROR 0#define STACK_INIT_DATA 20#define STACKINCREMENT 10typedef char Elemtype;typedef i...原创 2019-08-04 16:14:07 · 605 阅读 · 0 评论 -
利用栈实现二进制数转化成八进制数
利用栈实现二进制数转化成八进制数#include “stdio.h”#include “stdlib.h”#include “math.h”#define OK 1#define ERROR 0#define STACK_INIT_DATA 20#define STACKINCREMENT 10typedef char Elemtype;typedef int Stat...原创 2019-08-03 21:50:49 · 748 阅读 · 0 评论 -
创建和遍历一颗普通的二叉树
创建和遍历一颗普通的二叉树#include "stdio.h"#include "stdlib.h"typedef char Elemtype ;typedef struct BiTNode{ Elemtype data; struct BiTNode *lchild; struct BiTNode *rchild;}BiTNode,*BiTtree;//前序的方法创建一棵二叉树...原创 2019-08-12 21:21:24 · 213 阅读 · 0 评论