当前位置:网站首页>Prove the time complexity of heap sorting
Prove the time complexity of heap sorting
2022-07-06 12:43:00 【Lemon leaf C】
Time complexity of reactor building
Because the heap is a complete binary tree , A full binary tree is also a complete binary tree . To simplify , Full binary tree will be used to prove .( Time complexity is an approximation , So more nodes will not affect the final result ):
Suppose the height of the tree is :
The first layer : Nodes , Need to move down layer
The first layer : Nodes , Need to move down layer
The first layer : Nodes , Need to move down layer
The first layer : Nodes , Need to move down layer
……
The first layer : Nodes , Need to move down layer
The total number of moving steps of the mobile node is :
①
②
② - ① Dislocation subtraction :
therefore , The time complexity of reactor construction is
边栏推荐
- [leetcode19] delete the penultimate node in the linked list
- idea中导包方法
- MySQL time, time zone, auto fill 0
- Gateway fails to route according to the service name, and reports an error service unavailable, status=503
- 基于Redis的分布式ID生成器
- Fairygui joystick
- Easy to use shortcut keys in idea
- [Leetcode15]三数之和
- [offer78] merge multiple ordered linked lists
- Get the position of the nth occurrence of the string
猜你喜欢
记一次云服务器被密码爆破的经历——关小黑屋、改密码、改端口
(五)R语言入门生物信息学——ORF和序列分析
程序设计大作业:教务管理系统(C语言)
Expected value (EV)
Unity3D,阿里云服务器,平台配置
Lock wait timeout exceeded try restarting transaction
dosbox第一次使用
(core focus of software engineering review) Chapter V detailed design exercises
FairyGUI简单背包的制作
[golang] leetcode intermediate - fill in the next right node pointer of each node & the k-smallest element in the binary search tree
随机推荐
MySQL時間、時區、自動填充0的問題
Gateway fails to route according to the service name, and reports an error service unavailable, status=503
MySQL占用内存过大解决方案
Meanings and differences of PV, UV, IP, VV, CV
Gateway 根据服务名路由失败,报错 Service Unavailable, status=503
(一)R语言入门指南——数据分析的第一步
数据库课程设计:高校教务管理系统(含代码)
JS變量類型以及常用類型轉換
What is the maximum length of MySQL varchar field
dosbox第一次使用
Esp8266 connect onenet (old mqtt mode)
编译原理:源程序的预处理及词法分析程序的设计与实现(含代码)
Learning notes of JS variable scope and function
JS 函数提升和var变量的声明提升
[899]有序队列
(四)R语言的数据可视化——矩阵图、柱状图、饼图、散点图与线性回归、带状图
[Offer29] 排序的循环链表
基于Redis的分布式ID生成器
Knowledge summary of request
Unity场景跳转及退出