算法Sedgewick第四版-第1章基础-2.3 Quicksort-001快速排序
一、
1.特点
(1)The quicksort algorithm’s desirable features are that it is in-place (uses only a small auxiliary stack) and that
it requires time proportional to N log N on the average to sort an array of length N.
(2)quicksort has a shorter inner loop than most other sorting algorithms, which means that it is fast in practice as well as in theory.
2.缺点:
(1)Its primary drawback is that it is fragile in the sense that some care is involved in the implementation to be sure to avoid bad performance.
(2)
二、
算法Sedgewick第四版-第1章基础-2.3 Quicksort-001快速排序的更多相关文章
- 算法Sedgewick第四版-第1章基础-001递归
一. 方法可以调用自己(如果你对递归概念感到奇怪,请完成练习 1.1.16 到练习 1.1.22).例如,下面给出了 BinarySearch 的 rank() 方法的另一种实现.我们会经常使用递归, ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-001选择排序法(Selection sort)
一.介绍 1.算法的时间和空间间复杂度 2.特点 Running time is insensitive to input. The process of finding the smallest i ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-007归并排序(自下而上)
一. 1. 2. 3. 二.代码 package algorithms.mergesort22; import algorithms.util.StdIn; import algorithms.uti ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-006归并排序(Mergesort)
一. 1.特点 (1)merge-sort : to sort an array, divide it into two halves, sort the two halves (recursivel ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-005插入排序的改进版
package algorithms.elementary21; import algorithms.util.StdIn; import algorithms.util.StdOut; /***** ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-004希尔排序法(Shell Sort)
一.介绍 1.希尔排序的思路:希尔排序是插入排序的改进.当输入的数据,顺序是很乱时,插入排序会产生大量的交换元素的操作,比如array[n]的最小的元素在最后,则要经过n-1次交换才能排到第一位,因为 ...
- 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-002插入排序法(Insertion sort)
一.介绍 1.时间和空间复杂度 运行过程 2.特点: (1)对于已排序或接近排好的数据,速度很快 (2)对于部分排好序的输入,速度快 二.代码 package algorithms.elementar ...
- 算法Sedgewick第四版-第1章基础-1.3Bags, Queues, and Stacks-001可变在小的
1. package algorithms.stacks13; /******************************************************************* ...
- 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-005计测试算法
1. package algorithms.analysis14; import algorithms.util.StdOut; import algorithms.util.StdRandom; / ...
- 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-002如何改进算法
1. package algorithms.analysis14; import algorithms.util.In; import algorithms.util.StdOut; /******* ...
随机推荐
- 按返回键退出程序但不销毁代码,像QQ一样,后台运行
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BA ...
- 剑指Offer-翻转单词顺序
题目描述: 输入一个英文句子,翻转句子中单词的顺序,但单词内字符串的顺序不变.例如输入字符串:"I am a student",则输出"student a am I&qu ...
- 团队开发中Git冲突解决
正常来说我们团队协作开发过程中,冲突是常有的事,下面介绍下本人在开发中的解决办法. 冲突的主要原因就是由于我们开发人员在分支的同一位置写入了不一样的代码,然后合并到主干上导致我们冲突. 方法: 当冲突 ...
- storm入门原理介绍
转自:http://www.cnblogs.com/wuxiang/p/5629138.html 1.hadoop有master与slave,Storm与之对应的节点是什么?2.Storm控制节点上面 ...
- 冒泡算法-bubble
冒泡算法在数据只有几个无序时是最快的算法,但是如果全部无序的话就变成了最慢的算法了,时间复杂度为O(n^2) public class bubbleSort { public static void ...
- JSDoc 介绍
什么是JSDoc JSDoc是一个根据javascript文件中注释信息,生成JavaScript应用程序或库.模块的API文档 的工具.你可以使用他记录如:命名空间,类,方法,方法参数等.类似Jav ...
- 常用Kerberos指令
1. 以超管身份进入kadminkadmin.local addprinc -randkey root/master1@JENKIN.COM //生成随机key的principal addprin ...
- BZOJ2054:疯狂的馒头
浅谈并查集:https://www.cnblogs.com/AKMer/p/10360090.html 题目传送门:https://lydsy.com/JudgeOnline/problem.php? ...
- 运行flask程序
Command Line Interface Installing Flask installs the flask script, a Click command line interface, i ...
- JAX-WS注解
JAX-WS注解: javax.jws.WebService @WebService应用于类或者接口上面,该类便是一个对外访问WebService,默认情况里面所有的public方法都是可以对外提供访 ...