当前位置:网站首页>二叉树和图2
二叉树和图2
2022-06-10 13:39:00 【tnan2522】
红黑树
红黑树也是二叉树,也可以叫动态平衡二叉树, 它可以在储存的过程时动态的平衡树的节点储存
如, 我要储存一个列表的数据,但是这个列表中的数据是已经排序好了的, 如:
lists = [10, 20, 30, 40, 50, 60, 70, 80, 90]
当用普通的二叉树进行存储的时候,储存的结果是这样子的
它会一根筋的往右下角储存,这时候就体现不出来二叉树的查询效率了,因为这时候的二叉树就相当于一个列表了,如果要查 30 这个数据的话,那么这个二叉树要查 3 次,完全不方便
这时候就可以使用红黑树了,红黑树可以动态的调整树的结构,可以将这种情况将深度换成广度
它可以自动的调整节点,这样就做到了平衡效果
图
图(Graph)和树比起来,是一种更加复杂的非线性表结构。
图是由点之间连接形成的一个图
通过A 指向 C C 指向 E E 指向 。。。来完成一个图, 这个指向的关系线就叫做边
节点的指向叫做度,有多少个指向就有多少个度, 如 A中有三个度, A -> B A-> C A -> D
有三个指向就有三个度
有向图&无向图
在一些博客中,可以让用户关注别人,但是别人可以不关注该用户的,这种就是有向图
有 向图中有入度和出度,
入度就是有多少个数据执行该数据, 如 D -> A A就有一个入度
出度就是 该数据指向多少个数据 如 A -> B A -> C A有两出度
图的储存
图的储存可以使用:
邻接矩阵存储方法
邻接表存储方法
邻接表存储方法

在一个节点中,储存这这个节点的所有出度的数据,这中储存就是邻接表存储方法
当 有边是无向图的时候,可以把这两个数据当做相互指向的有向图
边栏推荐
- CentOS Linux 已死!Oracle Linux 可能是它的更好替代品
- Buuctf [glassfish] arbitrary file reading
- 【笔记】关于keil中的出现的编译映射内存不足的问题
- markdown设置字体为红色
- Sohu employees encounter wage subsidy fraud. What is the difference between black property and gray property and how to trace the source?
- New features mail GPU counter module adds GPU primitive processing and GPU shader cycles
- 618 大促来袭,浅谈如何做好大促备战
- Kotlin practises. Take login as an example. Anko simply uses it
- TabLayout 使用详解(修改文字大小、下划线样式等)
- 短文本重复率快速检测
猜你喜欢

How does the API detect security configuration errors?

【无标题】音频蓝牙语音芯片,WT2605C-32N实时录音上传技术方案介绍

解决win10虚拟机和主机不能互相粘贴复制的问题

Smart campus security channel and video monitoring solution

Mmdetection adds precision to the evaluation index

im即时通讯开发:进程被杀底层原理、APP应对被杀技巧

win10虚拟机下载安装流程

【技术分析】探讨大世界游戏的制作流程及技术——前期流程篇

New features mail GPU counter module adds GPU primitive processing and GPU shader cycles
![[FAQ] résumé des problèmes courants et des solutions lors de l'utilisation de l'interface API rest du Service de santé sportive](/img/ff/96a0a77795b271bef3a8ade2d646c3.png)
[FAQ] résumé des problèmes courants et des solutions lors de l'utilisation de l'interface API rest du Service de santé sportive
随机推荐
【操作教程】如何正确使用海康demo工具配置通道上线?
【无标题】音频蓝牙语音芯片,WT2605C-32N实时录音上传技术方案介绍
【笔记】关于keil中的出现的编译映射内存不足的问题
Cardview usage and properties
【Multisim仿真】差分放大电路2
Sohu employees encounter wage subsidy fraud. What is the difference between black property and gray property and how to trace the source?
Qt: accessing controls in other forms
启牛能开户吗,在APP上可以直接开通券商安全吗
如何定位游戏发热问题
【FAQ】運動健康服務REST API接口使用過程中常見問題和解决方法總結
[yellow code] SVN version control tutorial
im即时通讯开发:进程被杀底层原理、APP应对被杀技巧
What happened when the legendary login prompt failed to connect to the server? How to solve it?
How to locate the hot problem of the game
Apple邮箱配置QQ邮箱,163邮箱,edu邮箱,gmail邮箱,获取gmail日历
Qualcomm has finally begun to develop its own core architecture after learning from the difficulties of assembling chips to maintain its competitive advantage
Application analysis of key recording and playing of wt2003h4-16s voice chip
lua 表操作
What needs to be done for mobile app performance testing? How much is the performance test report charged?
Smart campus security channel and video monitoring solution