二叉树的层序遍历(递归和非递归)

二叉树的定义node typedef struct node{spa struct node *left, *right;递归 int val;io }Node, *BinTree;ast 非递归实现二叉树的层序遍历:class void PrintTree(BinTree root)二叉树 {遍历 if(!root)queue return;while queue<Node *> q; q.pu
相关文章
相关标签/搜索