当前位置:网站首页>C binary tree structure definition and node value addition
C binary tree structure definition and node value addition
2022-06-29 12:53:00 【Dusk and starry sky】
This article explains C# Binary tree structure definition 、 Add node value
///
/// The definition of binary tree
///
public class BiTNode
{
public BiTNode() { }
public int data;// Data fields
public BiTNode lchild;
public BiTNode rchild;
}
actual main Program testing
public const int MaxSize = 50;
static void Main(string[] args)
{
BiTNode T = new BiTNode() ;
int x=0;
// Create a binary tree
T.data = 1;
T.lchild= new BiTNode();
T.lchild.data = 2;
T.rchild = new BiTNode();
T.rchild.data = 3;
T.lchild.rchild=new BiTNode();
T.lchild.rchild.data = 4;
T.lchild.rchild.lchild= new BiTNode();
T.lchild.rchild.lchild.data = 6;
T.rchild.rchild = new BiTNode();
T.rchild.rchild.data = 5;
Console.WriteLine(“ The value of traversal first :”);
PreOrder(T);
Console.WriteLine();
Console.WriteLine(“ The value of middle order traversal :”);
InOrder(T);
Console.WriteLine();
Console.WriteLine(“ The value of post order traversal :”);
PostOrder(T);
Console.WriteLine();
Console.WriteLine(“ The value of an ordered traversal in non recursion :”);
InOrder2(T);
Console.WriteLine();
Console.WriteLine(“ Value of hierarchy traversal :”);
LevelOrder(T);
Console.ReadLine();
}

边栏推荐
- Cmake error
- 【综合案例】信用卡虚拟交易识别
- Testing -- automated testing: about the unittest framework
- Comment calculer Win / Tai / Loss in paired t - test
- 如果我在深圳,到哪里开户比较好?另外想问,现在在线开户安全么?
- How to fix ora-01017: invalid user name / password login denied
- MySQL master-slave synchronous asynchronous replication semi synchronous replication full synchronous replication
- ERP Kingdee for preparing BOM
- Syntax of gbase8s database incompatible with for update clause
- 二十三、1-Bit数据的存储(延迟线/磁芯/DRAM/SRAM/磁带/磁盘/光盘/Flash SSD)
猜你喜欢

Aes-128-cbc-pkcs7padding encrypted PHP instance

1. opencv realizes simple color recognition

推荐模型复现(一):熟悉Torch-RecHub框架与使用

Unexpected ‘debugger‘ statement no-debugger

How to create new user for ORACLE 19c (CDB & PDB)

ERP preparation of BOM basis

Method area of JVM

Baidu cloud disk downloads large files without speed limit (valid for 2021-11 personal test)

Recommended model recurrence (I): familiar with torch rechub framework and use

How to install oracle19c in Centos8
随机推荐
huffman编码
Gbase 8s extended external connection 1
推荐模型复现(三):召回模型YoutubeDNN、DSSM
云龙开炮版飞机大战(完整版)
如何计算win/tai/loss in paired t-test
1. Opencv实现简单颜色识别
Difficult conversation breaks through the bottleneck of conversation and achieves perfect communication
墨菲安全入选中关村科学城24个重点项目签约
C # clue binary tree through middle order traversal
2022.6.28-----leetcode.324
如果我在深圳,到哪里开户比较好?另外想问,现在在线开户安全么?
Earth observation satellite data
Gbase8s database select has order by Clause 6
ERP Kingdee for preparing BOM
Inferiority complex and transcendence the meaning of life to you
Principle and process of MySQL master-slave replication
Set operator of gbase8s database in combined query
二十三、1-Bit数据的存储(延迟线/磁芯/DRAM/SRAM/磁带/磁盘/光盘/Flash SSD)
asp.net 项目使用aspnet_compiler.exe发布
倍福TwinCAT3 的OPC_UA通信测试案例