本文实例讲述了C#非递归先序遍历二叉树的方法。分享给大家供大家参考。具体如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
No
代码如下:请按先序遍历输入二叉树元素(每个结点一个字符,空结点为’=’):ABD==E==CF==G==
先序递归遍历:A B D E C F G中序递归遍历:D B E A F C G后序递归遍历:D E B F G C A层序递归遍历:ABCDEFG先序非递归遍历:A B D E C F G中序非递归遍历:D B E A F C G后序非递归遍历:D E B F G C A深度:请按任意键继续. . .
代码如下:#include#include
#define OK 1#define E