These slides explain the Transform and Conquer technique. I talked about three types of this technique which are: Presorting, Change Representation, and Problem Reduction. Presorting can be used to solve many problems such as finding repeated numbers, searching, finding mode, frequencies, median, etc. For changing the representation technique, I presented "Gauss Elimination", "Horner's Rule" as examples. Finally, I talked about finding LCM as an example of Problem Reduction.
2. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
2Transform and Conquer
3. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
3Transform and Conquer
6. Understand the concept of transform and conquer
6
Minimize Complication
Transform and Conquer
7. Understand the concept of transform and conquer
7
•Instance Simplification
•Change Representation
•Problem Reduction
Transform and Conquer
8. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
8Transform and Conquer
10. 10
Presorting
• Find if there is any repeated member
• Search
• Find mode
• Find frequencies
• Find the median
• …
Transform and Conquer
11. Presorting
11
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
12. Presorting
12
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
13. Presorting
13
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
14. Presorting
14
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
15. Presorting
15
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
16. Presorting
16
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
17. Presorting
17
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
18. Presorting
18
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
19. Presorting
19
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
20. Presorting
20
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
21. Presorting
21
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
22. Presorting
22
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
23. Presorting
23
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
24. Presorting
24
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
25. Presorting
25
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
26. Presorting
26
Find if there is any repeated member:
Algorithm:
Compare each pair and stop when finding repetition or
when all pairs are checked
Complication:
O(n2)
Transform and Conquer
27. Presorting
27
-12 2 3 4 15
Find if there is any repeated member:
1. Sort the list
Transform and Conquer
28. Presorting
28
-12 2 3 4 15
Find if there is any repeated member:
1. Linear scan for repeated members (Consequent)
Transform and Conquer
29. Presorting
29
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
30. Presorting
30
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
31. Presorting
31
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
32. Presorting
32
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
33. Presorting
33
Find if there is any repeated member:
Algorithm:
1. Sort the list
2. For i = 0 to n – 2:
2.1 if a[i] = a[i + 1] then return false
3. return true
Complication:
T(n) = Tsort(n) + Tscan(n)
Transform and Conquer
48. Presorting
48
Searching
Search 100 times in array with 1000 members:
With out presorting With presorting
100 * O(n) O(n.log(n)) + 100. O(log(n))
100,000 1000 * 3 + 100 * 3 = 3300
Transform and Conquer
49. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
49Transform and Conquer
50. Explain the concept of Gauss elimination
50
Change Representation
Transform and Conquer
51. Explain the concept of Gauss elimination
51
Change Representation
Transform and Conquer
52. Explain the concept of Gauss elimination
52
Change Representation
Transform and Conquer
53. Explain the concept of Gauss elimination
53
Change Representation
Transform and Conquer
65. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
65Transform and Conquer
71. • Understand the concept of transform and conquer
• List the applications of presorting
• Explain the concept of Gauss elimination
• Use Horner’s rule for evaluating polynomials
• Find the lowest common multiple of two numbers
71Transform and Conquer