当前位置:网站首页>二叉树的链式存储
二叉树的链式存储
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; //作为根结点的左孩子
边栏推荐
- Neo4j 中文开发者月刊 - 202206期
- 耐克如何常年霸榜第一名?最新财报答案来了
- 我在中山,到哪里开户比较好?实际上网上开户安全么?
- C knowledge point form summary 2
- Learning summary on June 28, 2022
- 构建外部模块(Building External Modules)
- About keil compiler, "file has been changed outside the editor, reload?" Solutions for
- Exploration and practice of inress in kubernetes
- 华为HMS Core携手超图为三维GIS注入新动能
- CPU 上下文切换的机制和类型 (CPU Context Switch)
猜你喜欢
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5](/img/f5/9c68b3dc30362d3776c262fdc13fd0.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5

The Missing Semester

Message queue monitoring refund task batch process

Mechanism and type of CPU context switch

Technology sharing | MySQL: how about copying half a transaction from the database?
![[classic example] classic list questions @ list](/img/d8/a259e5f9d08eacbef31254d1bc3304.jpg)
[classic example] classic list questions @ list

91. (chapitre Cesium) simulation de lancement de fusées cesium

About keil compiler, "file has been changed outside the editor, reload?" Solutions for

博途V15添加GSD文件

Software project management 9.2 Software project configuration management process
随机推荐
消息队列之监控退款任务批处理过程
Exploration and practice of inress in kubernetes
Onenet Internet of things platform - the console sends commands to mqtt product devices
力扣首页简介动画
Acly and metabolic diseases
Abbirb120 industrial robot mechanical zero position
[Maui] add click events for label, image and other controls
Theoretical basis of graph
Summary of JFrame knowledge points 1
Dlhsoft Kanban, Kanban component of WPF
Redis' attack tactics
自定义 grpc 插件
About keil compiler, "file has been changed outside the editor, reload?" Solutions for
用于分类任务的数据集划分脚本
自组织是管理者和成员的双向奔赴
Value/hush in redis
【datawhale202206】pyTorch推荐系统:召回模型 DSSM&YoutubeDNN
The Missing Semester
Joint Time-Frequency and Time Domain Learning for Speech Enhancement
Value/list in redis