带有链表和数组的堆排序实现 [英] Heap sort implementation with linked list and arrays

查看:216
本文介绍了带有链表和数组的堆排序实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用链接列表和数组来实现堆排序。

Heap sort can be implemented using linked list and arrays.

使用链接列表或数组来实现堆排序的理想方法是什么?

What would be the ideal method of doing it-using linked list or arrays?

使用数组和链表建立堆的时间复杂度是多少?两者都是O(nlogn)吗?

What is the time complexity to build heap using arrays and linked lists?Is it O(nlogn) for both?

什么是

推荐答案

二进制堆

时间复杂度
用大O表示法

Time complexity in big O notation

        Average        Worst case
Space   O(n)           O(n)
Search  N/A Operation  N/A Operation
Insert  O(log n)       O(log n)
Delete  O(log n)       O(log n)

所以,时间复杂度相同,而与是否使用链表数组无关。

So, Time complexity is the same independent of whether it is using linked lists arrays .

这篇关于带有链表和数组的堆排序实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆