The.Algorithm.Design.Manual.Springer-Verlag.1998
The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998
Median and Selection an animation of the linear-time selection algorithm. This animation is a good one. Notes: The linear expected-time algorithm for median and selection is due to Hoare [Hoa61]. Floyd and Rivest [FR75] provide an algorithm that uses fewer comparisons on average. Good expositions on lineartime selection include [AHU74, Baa88, CLR90, Raw92], with [Raw92] being particularly enlightening. A sport of considerable theoretical interest is determining exactly how many comparisons are sufficient to find the median of n items. The linear-time algorithm of Blum et. al. [BFP 72] proves that suffice, but we want to know what c is. A lower bower bound of 2n comparisons for median finding was given by Bent and John [BJ85]. In 1976, Schönhage, Paterson, and Pippenger [SPP76] presented an algorithm using 3n comparisons. Recently, Dor and Zwick [DZ95] proved that 2.95 n comparisons suffice. These algorithms attempt to minimize the number of element comparisons but not the total number of operations, and hence do not lead to faster algorithms in practice. Tight combinatorial bounds for selection problems are presented in [Aig88]. An optimal algorithm for computing the mode is presented in [DM80]. Related Problems: Priority queues (see page ), sorting (see page ). Next: Generating Permutations Up: Combinatorial Problems Previous: Searching Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK4/NODE150.HTM (3 of 3) [19/1/2003 1:30:40]
Generating Permutations Next: Generating Subsets Up: Combinatorial Problems Previous: Median and Selection Generating Permutations Input description: An integer n. Problem description: Generate (1) all or (2) a random or (3) the next permutation of length n. Discussion: A permutation describes an arrangement, or ordering, of things. Many algorithmic problems in this catalog seek the best way to order a set of objects, including traveling salesman (the least-cost order to visit n cities), bandwidth (order the vertices of a graph on a line so as to minimize the length of the longest edge), and graph isomorphism (order the vertices of one graph so that it is identical to another). Any algorithm for solving such problems exactly must construct a series of permutations along the way. There are n! permutations of n items, which grows so quickly that you can't expect to generate all permutations for n > 11, since 11! = 39,916,800. Numbers like these should cool the ardor of anyone interested in exhaustive search and help explain the importance of generating random permutations. Fundamental to any permutation-generation algorithm is a notion of order, the sequence in which the permutations are constructed, from first to last. The most natural generation order is lexicographic, the order they would appear if they were sorted numerically. Lexicographic order for n=3 is , file:///E|/BOOK/BOOK4/NODE151.HTM (1 of 5) [19/1/2003 1:30:42]
- Page 383 and 384: Matrix Multiplication Next: Determi
- Page 385 and 386: Matrix Multiplication The linear al
- Page 387 and 388: Determinants and Permanents Next: C
- Page 389 and 390: Determinants and Permanents exposit
- Page 391 and 392: Constrained and Unconstrained Optim
- Page 393 and 394: Constrained and Unconstrained Optim
- Page 395 and 396: Linear Programming variable assignm
- Page 397 and 398: Linear Programming The book [MW93]
- Page 399 and 400: Random Number Generation Next: Fact
- Page 401 and 402: Random Number Generation is largely
- Page 403 and 404: Random Number Generation Related Pr
- Page 405 and 406: Factoring and Primality Testing The
- Page 407 and 408: Factoring and Primality Testing Alg
- Page 409 and 410: Arbitrary-Precision Arithmetic If y
- Page 411 and 412: Arbitrary-Precision Arithmetic PARI
- Page 413 and 414: Knapsack Problem Next: Discrete Fou
- Page 415 and 416: Knapsack Problem is a subset of S'
- Page 417 and 418: Discrete Fourier Transform Next: Co
- Page 419 and 420: Discrete Fourier Transform an algor
- Page 421 and 422: Combinatorial Problems Next: Sortin
- Page 423 and 424: Sorting Next: Searching Up: Combina
- Page 425 and 426: Sorting The simplest approach to ex
- Page 427 and 428: Sorting operations, implying an sor
- Page 429 and 430: Searching large performance improve
- Page 431 and 432: Searching Notes: Mehlhorn and Tsaka
- Page 433: Median and Selection followed by fi
- Page 437 and 438: Generating Permutations The rank/un
- Page 439 and 440: Generating Permutations generating
- Page 441 and 442: Generating Subsets look right when
- Page 443 and 444: Generating Subsets above for detail
- Page 445 and 446: Generating Partitions Although the
- Page 447 and 448: Generating Partitions Two related c
- Page 449 and 450: Generating Graphs generate: ● Do
- Page 451 and 452: Generating Graphs Combinatorica [Sk
- Page 453 and 454: Calendrical Calculations Next: Job
- Page 455 and 456: Calendrical Calculations Gregorian,
- Page 457 and 458: Job Scheduling ● To assign a set
- Page 459 and 460: Job Scheduling shop scheduling incl
- Page 461 and 462: Satisfiability logic, and automatic
- Page 463 and 464: Satisfiability Next: Graph Problems
- Page 465 and 466: Graph Problems: Polynomial-Time rec
- Page 467 and 468: Connected Components Testing the co
- Page 469 and 470: Connected Components discussing gra
- Page 471 and 472: Topological Sorting contradiction t
- Page 473 and 474: Minimum Spanning Tree Next: Shortes
- Page 475 and 476: Minimum Spanning Tree help you sort
- Page 477 and 478: Shortest Path Next: Transitive Clos
- Page 479 and 480: Shortest Path easier to program tha
- Page 481 and 482: Shortest Path Related Problems: Net
- Page 483 and 484: Transitive Closure and Reduction
Generating Permutations<br />
Next: Generating Subsets Up: Combinatorial Problems Previous: Median and Selection<br />
Generating Permutations<br />
Input description: An integer n.<br />
Problem description: Generate (1) all or (2) a random or (3) the next permutation of length n.<br />
Discussion: A permutation describes an arrangement, or ordering, of things. Many algorithmic problems<br />
in this catalog seek the best way to order a set of objects, including traveling salesman (the least-cost<br />
order to visit n cities), bandwidth (order the vertices of a graph on a line so as to minimize the length<br />
of the longest edge), and graph isomorphism (order the vertices of one graph so that it is identical to<br />
another). Any algorithm for solving such problems exactly must construct a series of permutations along<br />
the way.<br />
<strong>The</strong>re are n! permutations of n items, which grows so quickly that you can't expect to generate all<br />
permutations for n > 11, since 11! = 39,916,800. Numbers like these should cool the ardor of anyone<br />
interested in exhaustive search and help explain the importance of generating random permutations.<br />
Fundamental to any permutation-generation algorithm is a notion of order, the sequence in which the<br />
permutations are constructed, from first to last. <strong>The</strong> most natural generation order is lexicographic, the<br />
order they would appear if they were sorted numerically. Lexicographic order for n=3 is ,<br />
file:///E|/BOOK/BOOK4/NODE151.HTM (1 of 5) [19/1/2003 1:30:42]