数据结构
来源:互联网 发布:淘宝联盟怎么样提现 编辑:程序博客网 时间:2024/04/28 09:33
http://student.zjzk.cn/course_ware/data_structure/web/paixu/paixu8.3.2.2.htm
These are all comparison sorts, and so cannot perform better than O(n log n) in the average or worst case.
or
Depends on gap sequence;
best known is NoInsertionSmall code size, no use of call stack, reasonably fast, useful where memory is at a premium such as embedded and older mainframe applications.Bubble sortYesExchangingTiny code size.Binary tree sortYesInsertionWhen using a self-balancing binary search tree.Cycle sort—NoInsertionIn-place with theoretically optimal number of writes.Library sort—YesInsertion Patience sorting——NoInsertion & SelectionFinds all the longest increasing subsequences in O(n log n).SmoothsortNoSelectionAn adaptive sort: comparisons when the data is already sorted, and 0 swaps.Strand sortYesSelection Tournament sort—[4] ?Selection Cocktail sortYesExchanging Comb sortNoExchangingSmall code size.Gnome sortYesExchangingTiny code size.UnShuffle Sort[5]In place for linked lists. N*sizeof(link) for array.Can be made stable by appending the input order to the key.Distribution and MergeNo exchanges are performed. Performance is independent of data size. The constant 'k' is proportional to the entropy in the input. K = 1 for ordered or ordered by reversed input so runtime is equivalent to checking the order O(N).Franceschini's method[6]—Yes? Block sortYesInsertion & MergingCombine a block-based O(n) in-place merge algorithm[7] with a bottom-up merge sort.
The following table describes integer sorting algorithms and other sorting algorithms that are not comparison sorts. As such, they are not limited by a lower bound. Complexities below assume n items to be sorted, with keys of size k, digit size d, and r the range of numbers to be sorted. Many of them are based on the assumption that the key size is large enough that all entries have unique key values, and hence that n << 2k, where << means "much less than."
The following table describes some sorting algorithms that are impractical for real-life use due to extremely poor performance or specialized hardware requirements.
Theoretical computer scientists have detailed other sorting algorithms that provide better than O(n log n) time complexity assuming additional constraints, including:
- Han's algorithm, a deterministic algorithm for sorting keys from a domain of finite size, taking O(n log log n) time and O(n) space.[10]
- Thorup's algorithm, a randomized algorithm for sorting keys from a domain of finite size, taking O(n log log n) time and O(n) space.[11]
- A randomized integer sorting algorithm taking expected time and O(n) space.[12]
参考
对数函数 http://baike.baidu.com/view/331649.htm
算法时间复杂度计算 http://univasity.iteye.com/blog/1164707
各种算法介绍 http://en.wikipedia.org/wiki/Sorting_algorithm
快速排序java实现 http://www.vogella.com/tutorials/JavaAlgorithmsQuicksort/article.html
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- erlang一道笔试题
- update更新两个字段
- 本页面切换窗口
- 周末的好时光用来做什么
- Java使用IO类库读取文本
- 数据结构
- IO流简介
- iOS 文件/文件夹 压缩封装方法
- 一个工作了10年的程序员对IT行业的总结
- Javascript(ECMAScript) 对象类型
- 【拓扑排序】poj 1094 Sorting It All
- 简洁是智慧的灵魂,冗长是肤浅的藻饰
- python报错之解决 No module named win32com.client
- erlang服务器通用框架