{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

15-DecreaseAndConquer

15-DecreaseAndConquer - Algorithm Design Techniques Brute...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full Document Right Arrow Icon
B.B. Karki, LSU 0.1 CSC 3102 Decrease-and-Conquer
Background image of page 2
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.
Background image of page 3

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

View Full Document Right Arrow Icon
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
Background image of page 4
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.
Background image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}