二叉树
_sophon
Brooding renders me prophetic
展开
-
二叉树(递归)
文章目录类型定义先序遍历中序遍历后序遍历层序遍历建树完整 类型定义 typedef char DataType; typedef struct BTreeNode { DataType data; struct BTreeNode * leftchild; struct BTreeNode * rightchild; }BinTreeNode; typedef BinTreeNode * ...原创 2019-02-19 20:19:48 · 6252 阅读 · 0 评论 -
二叉树(非递归)
#include <bits/stdc++.h> using namespace std; typedef char DataType; typedef struct BTreeNode { DataType data; struct BTreeNode * leftchild; struct BTreeNode * rightchild; }BinTreeNode; typ...原创 2019-02-20 14:33:31 · 711 阅读 · 0 评论 -
二叉树 其他
统计叶子数 int CountLeafNode(BinTree bt) { if(bt==NULL) { return 0; } if(bt->leftchild==NULL&&bt->rightchild==NULL) { return 1; } return (CountLeafNode(bt->leftchild)+CountLea...原创 2019-02-20 15:07:45 · 89 阅读 · 0 评论