The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998

18.04.2013 Views

Arbitrary-Precision Arithmetic Euclid's algorithm for computing the greatest common divisor of two numbers is perhaps the oldest interesting algorithm. Expositions include [CLR90, Man89]. Related Problems: Factoring integers (see page ), cryptography (see page ). Next: Knapsack Problem Up: Numerical Problems Previous: Factoring and Primality Testing Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK4/NODE144.HTM (5 of 5) [19/1/2003 1:30:30]

Knapsack Problem Next: Discrete Fourier Transform Up: Numerical Problems Previous: Arbitrary-Precision Arithmetic Knapsack Problem Input description: A set of items , where item i has size and value . A knapsack capacity C. Problem description: Find the subset that maximizes the value of given that ; i.e. all the items fit in a knapsack of size C. Discussion: The knapsack problem arises whenever there is resource allocation with financial constraints. Given a fixed budget, how do you select what things you should buy. Everything has a cost and value, so we seek the most value for a given cost. The term knapsack problem invokes the image of the backbacker who is constrained by a fixed-size knapsack and so must fill it only with the most useful items. The typical formulation in practice is the 0/1 knapsack problem, where each item must be put entirely in the knapsack or not included at all. Objects cannot be broken up arbitrarily, so its not fair taking one can of coke from a six-pack or opening the can to take just a sip. It is this 0/1 property that makes the knapsack problem hard, for a simple greedy algorithm finds the optimal selection whenever we are allowed to subdivide objects arbitrarily. For each item, we could compute its ``price per pound'', and take as much of the most expensive item until we have it all or the knapsack is full. Repeat with the next file:///E|/BOOK/BOOK4/NODE145.HTM (1 of 4) [19/1/2003 1:30:33]

Arbitrary-Precision Arithmetic<br />

Euclid's algorithm for computing the greatest common divisor of two numbers is perhaps the oldest<br />

interesting algorithm. Expositions include [CLR90, Man89].<br />

Related Problems: Factoring integers (see page ), cryptography (see page ).<br />

Next: Knapsack Problem Up: Numerical Problems Previous: Factoring and Primality Testing<br />

<strong>Algorithm</strong>s<br />

Mon Jun 2 23:33:50 EDT 1997<br />

file:///E|/BOOK/BOOK4/NODE144.HTM (5 of 5) [19/1/2003 1:30:30]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!