随笔分类 -  算法Sedgewick第四版

摘要: 阅读全文
posted @ 2016-04-28 17:56 shamgod 阅读(164) 评论(0) 推荐(0)
摘要:一、 1.特点 (1)The quicksort algorithm’s desirable features are that it is in-place (uses only a small auxiliary stack) and thatit requires time proportio 阅读全文
posted @ 2016-04-26 15:09 shamgod 阅读(333) 评论(0) 推荐(0)
摘要:一、 1. 2. 3. 二、代码 阅读全文
posted @ 2016-04-26 11:24 shamgod 阅读(458) 评论(0) 推荐(0)
摘要:一、 1.特点 (1)merge-sort : to sort an array, divide it into two halves, sort the two halves (recursively), and then merge the results. As you will see, o 阅读全文
posted @ 2016-04-26 11:08 shamgod 阅读(401) 评论(0) 推荐(0)
摘要:用二分查找法改进 阅读全文
posted @ 2016-04-22 17:20 shamgod 阅读(296) 评论(0) 推荐(0)
摘要:一、介绍 1.希尔排序的思路:希尔排序是插入排序的改进。当输入的数据,顺序是很乱时,插入排序会产生大量的交换元素的操作,比如array[n]的最小的元素在最后,则要经过n-1次交换才能排到第一位,因为插入排序元素只能一位一位地交换。基于插入排序的这个缺点,希尔排序是以一个区间来的交换元素,然后不断缩 阅读全文
posted @ 2016-04-22 16:24 shamgod 阅读(403) 评论(0) 推荐(0)
摘要:一、介绍 1. 2. 二、代码 1. 2. 3. 4. 阅读全文
posted @ 2016-04-22 12:23 shamgod 阅读(378) 评论(0) 推荐(0)
摘要:一、介绍 1.时间和空间复杂度 运行过程 2.特点: (1)对于已排序或接近排好的数据,速度很快 (2)对于部分排好序的输入,速度快 二、代码 阅读全文
posted @ 2016-04-22 11:48 shamgod 阅读(228) 评论(0) 推荐(0)
摘要:一、介绍 1.算法的时间和空间间复杂度 2.特点 Running time is insensitive to input. The process of finding the smallest item on onepass through the array does not give muc 阅读全文
posted @ 2016-04-22 11:04 shamgod 阅读(320) 评论(0) 推荐(0)
摘要:Given an array a[] of N real numbers, design a linear-time algorithm to find the maximum value of a[j] - a[i] where j ≥ i. 阅读全文
posted @ 2016-04-21 12:06 shamgod 阅读(198) 评论(0) 推荐(0)
摘要:1 package algorithms.analysis14; 2 3 import algorithms.util.StdOut; 4 import algorithms.util.StdRandom; 5 6 /****************************************************************************** ... 阅读全文
posted @ 2016-04-20 18:37 shamgod 阅读(363) 评论(0) 推荐(0)
摘要:1. 2. 3.字符串 阅读全文
posted @ 2016-04-20 18:14 shamgod 阅读(173) 评论(0) 推荐(0)
摘要:1. 2. 3. 4. 5. 6. 阅读全文
posted @ 2016-04-20 17:41 shamgod 阅读(128) 评论(0) 推荐(0)
摘要:1. The answer to this question is that we have discussed and used two classic algorithms,mergesort and binary search, have introduced the facts that t 阅读全文
posted @ 2016-04-20 16:41 shamgod 阅读(930) 评论(1) 推荐(0)
摘要:For many programs, developing a mathematical model of running timereduces to the following steps:■Develop an input model, including a definition of th 阅读全文
posted @ 2016-04-20 15:00 shamgod 阅读(326) 评论(0) 推荐(0)
摘要:1 package algorithms.util; 2 3 /****************************************************************************** 4 * Compilation: javac Directory.java 5 * Execution: java Directory dire... 阅读全文
posted @ 2016-04-20 11:56 shamgod 阅读(175) 评论(0) 推荐(0)
摘要:1 /****************************************************************************** 2 * Compilation: javac MM1Queue.java 3 * Execution: java MM1Queue lambda mu 4 * Dependencies: Queue.j... 阅读全文
posted @ 2016-04-20 11:50 shamgod 阅读(453) 评论(0) 推荐(0)

haha