数据结构上机实验报告-二叉树(2)
时间:2025-05-04
时间:2025-05-04
验的目建一棵立二树叉要,分别求递用归和递非方法实归二现 叉树的先、序序中和序遍后历。
实现代码:
#ifndef TREE_H #define TREE_H #include <stdio.h> #include <malloc.h> #include <stack> #include <queue> #include <assert.h> using namespace std; typedefintElemType; typedef struct treeT { ElemType key; struct treeT* left; struct treeT* right; }treeT, *pTreeT;