二叉树的前序遍历
来源:互联网 发布:阿拉伯血钻野燕麦知乎 编辑:程序博客网 时间:2024/04/30 21:59
二叉树的前序遍历
不过话说回来,递归好用的很,
/*二叉树的遍历*/#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef struct node //定义一个节点的结构体{ struct node *lchild; char data; struct node *rchild;}bitnode, *bitree;bitree CreatTree()//创建一个树{ char a; bitree g; scanf("%c", &a); if (a == '#') return NULL; else { g = (bitree)malloc(sizeof(bitnode)); g->data = a; g->lchild = CreatTree(); g->rchild = CreatTree(); } return g;}void preorderTraverse(bitree bt){ if (bt != NULL) { printf("%c\t", bt->data); preorderTraverse(bt->lchild); preorderTraverse(bt->rchild); } else return ;}void main(){ bitree root; root = CreatTree(); preorderTraverse(root); system("pause");}
1 0
- java二叉树的前序遍历
- 算法:二叉树的前序遍历
- 二叉树的前序遍历算法
- 题目:二叉树的前序遍历
- 二叉树的前序遍历
- LintCode -- 二叉树的前序遍历
- lintcode 二叉树的前序遍历
- 二叉树的前序遍历
- 二叉树的前序遍历
- lintcode,二叉树的前序遍历
- 二叉树的前序遍历
- 二叉搜索树的前序遍历
- LintCode-二叉树的前序遍历
- 二叉树的前序遍历
- 二叉树的前序遍历
- lintcode 二叉树的前序遍历
- 二叉树的前序遍历
- 二叉树的前序遍历
- 网站高并发(一)
- Inventor API: 简单聊聊ReplaceReference , FileSaveAs, OnFileResolution
- iOS-OC-NSDictionary和NSMutableDictionary用法大全详细说明
- 7、JSONArray的应用
- 回到顶部功能实现
- 二叉树的前序遍历
- IOS UI 手写UILable
- SharedPreferences详解
- Problem P
- ubuntu 上安装opencv以及测试
- jquery-zclip插件
- DataBinding学习(五)
- BW ZCHANGE_PACKAGE
- iOS-OC-NSArray用法大全详细说明