当前位置:网站首页>二叉树的链式存储
二叉树的链式存储
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 Chinese developer monthly - issue 202206
- Onenet Internet of things platform - the console sends commands to mqtt product devices
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 2
- About keil compiler, "file has been changed outside the editor, reload?" Solutions for
- Uniapp uses uni upgrade Center
- On recursion and Fibonacci sequence
- Message queue monitoring refund task batch process
- [MCU] [nixie tube] nixie tube display
- Personnaliser le plug - in GRPC
- Building external modules
猜你喜欢

博途V15添加GSD文件
![[Maui] add click events for label, image and other controls](/img/d6/7ac9632681c970ed99c9e4d3934ddc.jpg)
[Maui] add click events for label, image and other controls
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7](/img/41/e3ecbd49e4bfeab6c6e7d8733fe33a.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 7

【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE

GID:旷视提出全方位的检测模型知识蒸馏 | CVPR 2021

ABBIRB120工业机器人机械零点位置

Technology sharing | MySQL: how about copying half a transaction from the database?

Comment Cao définit la décimale de dimension

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

The Missing Semester
随机推荐
Is it safe for Huatai Securities to open an account online?
Custom grpc plug-in
Golang des-cbc
邻接矩阵无向图(一) - 基本概念与C语言
Theoretical basis of graph
Comment Nike a - t - il dominé la première place toute l'année? Voici les derniers résultats financiers.
Istio, ebpf and rsocket Broker: in depth study of service grid
C serialization simple experiment
Neo4j Chinese developer monthly - issue 202206
[MCU] [nixie tube] nixie tube display
Force button homepage introduction animation
Impressive bug summary (continuously updated)
S7-1500plc simulation
JS date format conversion method
Sum of factor numbers of interval product -- prefix sum idea + fixed one shift two
Botu V15 add GSD file
Redis' attack tactics
CPI tutorial - asynchronous interface creation and use
自定义 grpc 插件
Machine learning - Data Science Library - day two