当前位置:网站首页>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();
}

边栏推荐
- Interpolated scatter data
- Set operator of gbase8s database in combined query
- 内插散点数据
- NvtBack
- Cereal mall project
- Testing -- automated testing: about the unittest framework
- 推荐模型复现(四):多任务模型ESMM、MMOE
- go 学习-搭建开发环境vscode开发环境golang
- Introduction to multi project development - business scenario Association basic introduction test payroll
- 从Mpx资源构建优化看splitChunks代码分割
猜你喜欢

How to calculate win/tai/loss in paired t-test

Unexpected ‘debugger‘ statement no-debugger

Interview shock 61: tell me about MySQL transaction isolation level?

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

倍福TwinCAT配置、调试第三方伺服详细讲解--以汇川IS620N为例子

Introduction to multi project development - business scenario Association basic introduction test payroll

MIT linear algebra Chinese Notes

【JUC系列】同步工具类之ThreadLocal

智能指标驱动的管理和决策平台 Kyligence Zen 全新上线,限量内测中

如何计算win/tai/loss in paired t-test
随机推荐
C#线索二叉树的定义
Go question bank · 14 the pit of waitgroup
Uncover the practice of Baidu intelligent test in the field of automatic test execution
Testing -- automated testing: about the unittest framework
qt json
23、 1-bit data storage (delay line / core /dram/sram/ tape / disk / optical disc /flash SSD)
MFC dialog program core -isdialogmessage function -msg message structure -getmessage function -dispatchmessage function
If I am in Shenzhen, where can I open an account? In addition, is it safe to open an account online now?
求大数的阶乘 ← C语言
LeetCode_ Double pointer_ Medium_ 328. parity linked list
倍福PLC通过CANOpen通信控制伺服
Gbase8s database for update clause
2022.6.28-----leetcode.324
Interview shock 61: tell me about MySQL transaction isolation level?
Kyligence Zen, an intelligent indicator driven management and decision-making platform, is newly launched and is in limited internal testing
Newton inequality
1. Opencv实现简单颜色识别
[cloud native] 2.4 kubernetes core practice (middle)
qt 自定义控件 :取值范围
Pangolin编译error: ‘numeric_limits’ is not a member of ‘std’