软基功课:二叉树的创建与遍历

软基作业:二叉树的创建与遍历题目要求:ex4_1:1)二叉树结点类型定义为:typedefstructbnode{intdatastructb

软基作业:二叉树的创建与遍历

题目要求:

ex4_1:

1)二叉树结点类型定义为:typedefstructbnode{  intdata;   structbnode*lc,*rc;}bnode_type;2)编写中序遍历函数;3)编写后序遍历函数;4)编写先序遍历函数;5)编写create函数建立二叉排序树;6)编写main()函数,先调用create函数,建立一颗二叉排序树;然后分别调用中序、后序、先序遍历函数,将二叉树的先序、中序和后序遍历序列输出到屏幕上。

程序如下: