当前位置:网站首页>二叉树的链式存储
二叉树的链式存储
2022-07-01 12:05:00 【Between the steps】
二叉树的顺序存储只适合完全二叉树和满二叉树,链式存储适合其它的。。
#include<stdio.h>
struct ElemType{
int data;
};
typedef struct BiTNode{
ElemType data;
struct BiTNode *lchild,*rchild; //有的可能加上了*parents 三叉链表
}BiTNode,*Bitree;
//定义一棵空树
Bitree root=NULL;
//插入根节点
root=(Bitree)malloc(sizeof(BiTNode));
root->data={
1};
root->lchild=NULL;
root->rchild=NULL;
//插入新结点
BiTNode *p=(BiTNode*)malloc(sizeof(BiTNode));
p->data={
2};
p->lchild=NULL;
p->rchild==NULL;
root->lchild=p; //作为根结点的左孩子
边栏推荐
- Sum of factor numbers of interval product -- prefix sum idea + fixed one shift two
- 91.(cesium篇)cesium火箭發射模擬
- I'm in Zhongshan. Where is a better place to open an account? Is it actually safe to open an account online?
- 力扣首页简介动画
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
- 【单片机】【数码管】数码管显示
- Kernel synchronization mechanism
- 241. 为运算表达式设计优先级 : DFS 运用题
- USB peripheral driver - cable connect/disconnect
- [Maui] add click events for label, image and other controls
猜你喜欢

Leetcode force buckle (Sword finger offer 31-35) 31 Stack push pop-up sequence 32i II. 3. Print binary tree from top to bottom 33 Post order traversal sequence 34 of binary search tree The path with a

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

91. (cesium chapter) cesium rocket launch simulation

如何看懂开发的查询语句

使用set_handler过滤掉特定的SystemC Wraning &Error Message

The operation process of using sugar to make a large data visualization screen

Summary of JFrame knowledge points 1

【20211129】Jupyter Notebook远程服务器配置

Typora adds watermarks to automatically uploaded pictures

Technology sharing | MySQL: how about copying half a transaction from the database?
随机推荐
Custom grpc plug-in
Istio、eBPF 和 RSocket Broker:深入研究服务网格
C serialization simple experiment
GID:旷视提出全方位的检测模型知识蒸馏 | CVPR 2021
Understanding of MVVM and MVC
C # dependency injection (straight to the point) will be explained as soon as you see the series
研发效能度量框架解读
Exploration and practice of inress in kubernetes
Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project
比特熊直播间一周年,英雄集结令!邀你来合影!
ABBIRB120工业机器人机械零点位置
Binary stack (I) - principle and C implementation
The operation process of using sugar to make a large data visualization screen
91. (cesium chapter) cesium rocket launch simulation
Use of easyexcel
Compile and debug net6 source code
自定義 grpc 插件
指纹浏览器工作原理、使用场景以及重要性简单讲解
LeetCode 454. Add four numbers II
MQ prevent message loss and repeated consumption