15-DecreaseAndConquer

15-DecreaseAndConquer - B.B. Karki, LSU 0.1 CSC 3102...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: B.B. Karki, LSU 0.1 CSC 3102 Algorithm Design Techniques Brute force Divide-and-conquer Decrease-and-conquer Transform-and-conquer Space-and-time tradeoffs Dynamic programming Greedy techniques B.B. Karki, LSU 0.1 CSC 3102 Decrease-and-Conquer B.B. Karki, LSU 0.2 CSC 3102 Basics Decrease-and-conquer 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 Decrease-by-One Decrease (by one)-and-conquer 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 n-1 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 Decrease-by-Half Decrease (by half)-and-conquer 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 divide-and-conquer 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.

Page1 / 15

15-DecreaseAndConquer - B.B. Karki, LSU 0.1 CSC 3102...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online