This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: B.B. Karki, LSU 0.1 CSC 3102 Algorithm Design Techniques Brute force Divideandconquer Decreaseandconquer Transformandconquer Spaceandtime tradeoffs Dynamic programming Greedy techniques B.B. Karki, LSU 0.1 CSC 3102 DecreaseandConquer B.B. Karki, LSU 0.2 CSC 3102 Basics Decreaseandconquer algorithm works as follows: Establish the relationship between a solution to a given instance of a problem and a solution to a smaller instance of the same problem. Exploit this relationship either top down (recursively) or bottom up (without a recursion). Three variations: Decrease by a constant The size of an instance is reduced by the same constant (usually one) at each iteration of the algorithm. Decrease by a constant factor The size of a problem instance is reduced by the same constant factor (usually two) on each iteration of the algorithm. Variable size decrease A size reduction pattern varies from one iteration to another. B.B. Karki, LSU 0.3 CSC 3102 DecreasebyOne Decrease (by one)andconquer technique is common. Exponentiation problem of computing a n . Exploit relation a n = a n  1 . a Top down solution uses the recursive definition Bottom up solution multiplies a by itself n 1. Requires O( n ) operations. Problem of size n subproblem of size n1 solution to the subproblem solution to the original problem f ( n ) = f ( n 1). a a for n > 1 for n = 1 B.B. Karki, LSU 0.4 CSC 3102 DecreasebyHalf Decrease (by half)andconquer technique is common. Decrease the problem size by a factor of 2. Exponentiation problem of computing a n . Exploit relation a n = ( a n /2)2 ) for even n Recursive approach: Requires O(log n ) operations. Note that the divideandconquer actually solves two instances of the problem of size n /2....
View
Full
Document
This note was uploaded on 10/06/2009 for the course CSC 3102 taught by Professor Kraft,d during the Fall '08 term at LSU.
 Fall '08
 Kraft,D

Click to edit the document details