
Intro to Algorithms 3rd.ed
文章平均质量分 64
cheetach_Jiang
这个作者很懒,什么都没留下…
展开
-
5.2-2 What is the probability that you hire exactly twice
In HIRE-ASSISTANT, assuming that the candidates are presented in a random order, what is the probability that you hire exactly twice?AnlysisObservation 1: You have to hire the first person int原创 2013-07-10 13:52:26 · 2206 阅读 · 0 评论 -
5.3-6 PERMUTE-BY-SORTING, if two or more priorities are identical
Problem 5.3-6Explain how to implement the algorithm PERMUTE-BY-SORTING to handle thecase in which two or more priorities are identical. That is, your algorithm shouldproduce a uniform random per原创 2013-07-10 18:03:19 · 1957 阅读 · 0 评论 -
6.5-8 Heap-Delete
6.5-8The operation HEAP-DELETE.A; i / deletes the item in node i from heap A. Givean implementation of HEAP-DELETE that runs in O.lg n/ time for an n-elementmax-heap.Solution1. Find the原创 2013-07-17 12:19:46 · 930 阅读 · 0 评论 -
6-3 Young tableaus
6-3 Young tableausAn m × n Young tableau is an m × n matrix such that the entries of each row arein sorted order from left to right and the entries of each column are in sorted orderfrom top to原创 2013-07-17 17:46:36 · 1611 阅读 · 0 评论 -
6.5-9 merge k sorted lists into one sorted list with O(n lg k)
6.5-9Give an O.n lg k/-time algorithm to merge k sorted lists into one sorted list,where n is the total number of elements in all the input lists. (Hint: Use a minheapfor k-way merging.)So原创 2013-07-17 12:30:55 · 2361 阅读 · 0 评论 -
9.2-3 Iterative version of Randomized-Select
9.2-3Write an iterative version of RANDOMIZED-SELECTAnalyse:For this the original recursive algorithm, the recursion doesn't need to remember the intermediate information, ie. there is no co原创 2013-07-29 10:20:11 · 986 阅读 · 0 评论 -
9.1-2 Find the second smallest of n elements.
9.1-1Show that the second smallest of n elements can be found with n + lg n - 2comparisons in the worst case. (Hint: Also find the smallest element.)I thinked about it for some time and原创 2013-07-29 10:07:26 · 788 阅读 · 1 评论 -
6.5.6 Three Assignment to 1
6.5.6Each exchange operation on line 5 of HEAP-INCREASE-KEY typically requiresthree assignments. Show how to use the idea of the inner loop of INSERTIONSORTto reduce the three assignments down t原创 2013-07-17 11:54:42 · 2572 阅读 · 0 评论