# The Art of Computer Programming, Volume 3: Sorting and Searching (2nd Edition)

## Donald E. Knuth

Language: English

Pages: 1

ISBN: 0201896850

Format: PDF / Kindle (mobi) / ePub

The first revision of this third volume is the most comprehensive survey of classical computer techniques for sorting and searching. It extends the treatment of data structures in Volume 1 to consider both large and small databases and internal and external memories. The book contains a selection of carefully checked computer methods, with a quantitative analysis of their efficiency. Outstanding features of the second edition include a revised section on optimum sorting and new discussions of the theory of permutations and of universal hashing.

Formal Languages and Compilation (2nd Edition) (Texts in Computer Science)

Principles of Data Mining (2nd Edition) (Undergraduate Topics in Computer Science)

computer operator is loading a scratch tape onto unit 6; since the total number S of runs is known once the initial distribution has been completed, the algorithm knows that S/9 runs should be merged to tape 4, then (S 蜢 3)/9 to tape 5, then (S 蜢 6)/9 to tape 6. The entire sorting procedure for this example can be summarized in the following way, using the notation introduced in Section 5.4.2: Example 2. Read-forward polyphase merge. The second example in Chart A carries out the polyphase

red-black trees, also called symmetric binary B-trees or half-balanced trees [R. Bayer, Acta Informatica 1 (1972), 290舑306; L. Guibas and R. Sedgewick, FOCS 19 (1978), 8舑21; H. J. Oliviȳ, RAIRO Informatique Thȳorique 16 (1982), 51舑71; R. E. Tarjan, Inf. Proc. Letters 16 (1983), 253舑257; T. H. Cormen, C. E. Leiserson, and R. L. Rivest, Introduction to Algorithms (MIT Press, 1990), Chapter 14; R. Sedgewick, Algorithms in C (Addison舑Wesley, 1997), ŧ13.4]. There is also a strongly related family

= 0 and F(1) = 1. Given that the keys K1, K2, . . ., KN are independently chosen at random from this distribution, and that M = cN, where c is constant and N 薔 蜴, prove that the average running time of Program M is O(N) when F is sufficiently smooth. (A key K is inserted into list j when MK = j 蜢1; this occurs with probability F(j/M) 蜢 F((j 蜢 1)/M). Only the case F(x) = x, 0 蠄 x 蠄 1, is treated in the text.) 39. [HM16] If a program runs in approximately A/M + B units of time and uses C + M

random input. Prove that quicksort will never require more than N stages; and explain why radix exchange often does. 40. [21] Explain how to modify Algorithm R so that it works with reasonable efficiency when sorting files containing numerous equal keys. ŠŠŠ41. [30] Devise a good way to exchange records Rl . . . Rr so that they are partitioned into three blocks, with (i) Kk < K for l 蠄 k < i; (ii) Kk = K for i 蠄 k 蠄 j; (iii) Kk > K for j < k 蠄 r. Schematically, the final arrangement should be

to be the sum, over all external nodes, of the level of that node times the value it contains. Prove that a real-valued search tree of order x and resolution 1 has minimum weighted path length, taken over all such trees of the same order and resolution, if and only if equality holds in (ii) and the following further conditions hold for all pairs of values x0 and x1 that are contained in sibling nodes: (iv) There is no integer k 蠅 0 such that x0 < 2k < x1 or x1 < 2k < x0. (v) x0 蜢 x0 + x1 蜢 x1 <