English 中文(简体)
为不同的数据结构找到第2号最低数值最复杂的情况是什么?
原标题:What s the worst-case complexity for finding n/2 smallest values for different data structures?

For different data structures such as linked lists, arrays (sorted/unsorted, trees etc. of size n, what is the worst-case time-complexity of finding the n/2 smallest values in each of them? Is it the same as the complexity for Find operations?

Edit: So, what s the complexity for these data structures? Unsorted Linked list, unsorted array, splay trees and hash tables?

问题回答

Not necessarily. For instance, for a sorted array you can find the n/2 smallest values in constant time.

它完全取决于数据结构,它是否是分类的。

如果你认为树木是平衡的,那么发现最小的数值是...... “所有价值观都与根基的“ft”。

You cannot generalize it quite as much, it depends fully on the data structure.

如果不具体说明算法,或至少说明数据结构,就不可能具体说明问题的复杂性。 有一些数据结构是绝对的夜班,没有使用更适合的中间储存结构。 举例来说,紧缩比阵列要困难得多,因为你不能随意抽取分子。

设想采用如下算法:BogoSort,而且你能够得到一些令人印象深刻的印象(因为缺乏一个更好的词)最坏的案件复杂性数字。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签