91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-09
  • 語言: C/C++
  • 標簽: 二叉樹??

資源簡介

自己編寫的代碼,利用隊列的特性來 按層次需求輸出二叉樹

資源截圖

代碼片段和文件信息

#include
#include
#include
using?namespace?std;

struct?BTreeNode??????????????//樹節點
{
int?Value;
BTreeNode?*Left;
BTreeNode?*Right;
};

void?Add(BTreeNode?*&Rootint?x)??????//插入數值?建立二叉樹
{
if(Root==NULL)
{
BTreeNode?*p=new?BTreeNode;
p->Value=x;
p->Right=NULL;
p->Left=NULL;
Root=p;
cout< }
if(x>Root->Value?)
Add(Root->Right?x);
if(xValue?)
Add(Root->Left?x);
}




void??Print(BTreeNode?*Root)????//按層次輸出???利用容器
{
?????if(Roo

評論

共有 條評論