SlideShare a Scribd company logo
1 of 79
By: Abdulrazak Zakieh
1Transform and Conquer
• 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
• 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
Understand the concept of transform and conquer
4Transform and Conquer
Understand the concept of transform and conquer
5Transform and Conquer
Understand the concept of transform and conquer
6
Minimize Complication
Transform and Conquer
Understand the concept of transform and conquer
7
•Instance Simplification
•Change Representation
•Problem Reduction
Transform and Conquer
• 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
9
Presorting
Instance Simplification
Input Sorted Input Find Solution
Transform and Conquer
10
Presorting
• Find if there is any repeated member
• Search
• Find mode
• Find frequencies
• Find the median
• …
Transform and Conquer
Presorting
11
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
12
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
13
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
14
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
15
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
16
15 0 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
17
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
18
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
19
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
20
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
21
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
22
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
23
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
24
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
Presorting
25
15 3 4 -12 2
Find if there is any repeated member:
Transform and Conquer
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
Presorting
27
-12 2 3 4 15
Find if there is any repeated member:
1. Sort the list
Transform and Conquer
Presorting
28
-12 2 3 4 15
Find if there is any repeated member:
1. Linear scan for repeated members (Consequent)
Transform and Conquer
Presorting
29
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
Presorting
30
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
Presorting
31
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
Presorting
32
-12 2 3 4 15
Find if there is any repeated member:
1. Linear search for repeated members (Consequent)
Transform and Conquer
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
Presorting
34
Find if there is any repeated member:
Complication: T(n) = Tsort(n) + Tscan(n)
O(n)
?Selection Sort
Bubble Sort
Insertion Sort
O(n2) Merge Sort
O(n.log(n))
Quick Sort
O(n.log(n))
O(n2)T(n) = O(n2) + O(n)
= O(n2) T(n) = O(n.log(n)) + O(n)
= O(n.log(n))T(n) = O(n2) + O(n)
= O(n2)
Transform and Conquer
Presorting
35
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
36
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
37
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
38
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
39
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
40
15 3 4 -12 2
Searching: find 6
Transform and Conquer
Presorting
41
Searching
Algorithm:
Linear search
Complication:
O(n)
Transform and Conquer
Presorting
42
-12 2 3 4 15
Searching
1. Sort the list
Transform and Conquer
Presorting
43
-12 2 3 4 15
Searching
2. Use binary search
Transform and Conquer
Presorting
44
Searching
Algorithm:
1. Sort the list
2. Binary Search
Complication:
T(n) = Tsort(n) + TBinarySearch(n)
Transform and Conquer
Presorting
45
Searching
Algorithm:
1. Sort the list
2. Binary Search
Complication:
T(n) = O(n.log(n)) + O(log(n))
Transform and Conquer
Presorting
46
Searching
Algorithm:
1. Sort the list
2. Binary Search
Complication:
T(n) = O(n.log(n))
Transform and Conquer
Presorting
47
Searching
Algorithm:
1. Sort the list
2. Binary Search
Complication:
T(n) = O(n.log(n))
Transform and Conquer
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
• 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
Explain the concept of Gauss elimination
50
Change Representation
Transform and Conquer
Explain the concept of Gauss elimination
51
Change Representation
Transform and Conquer
Explain the concept of Gauss elimination
52
Change Representation
Transform and Conquer
Explain the concept of Gauss elimination
53
Change Representation
Transform and Conquer
Explain the concept of Gauss elimination
54Transform and Conquer
Explain the concept of Gauss elimination
55Transform and Conquer
Explain the concept of Gauss elimination
56Transform and Conquer
Explain the concept of Gauss elimination
57
Augmented
Array
2 3 4 9
3 2 1 6
1 2 1 4
Transform and Conquer
Explain the concept of Gauss elimination
58
2 3 4 9
0 5 10 15
0 1 -2 -1
Transform and Conquer
Explain the concept of Gauss elimination
59
2 3 4 9
0 5 10 15
0 0 -20 -20
Transform and Conquer
Explain the concept of Gauss elimination
60
2 3 4 9
0 5 10 15
0 0 -20 -20
Solve By back
substitution
Transform and Conquer
Explain the concept of Gauss elimination
61
2 3 4 9
0 5 10 15
0 0 -20 -20
Solve By back
substitution
Z = 1
Y = 1
X = 1
Transform and Conquer
Gauss elimination
62
Algorithm:
Transform and Conquer
Gauss elimination
63
Algorithm:
Complication
T(n) = O(n3)
Transform and Conquer
LU Decomposition
64
Change Representation
Transform and Conquer
• 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
Horner’s Rule
66
Used for Evaluating Polynomials.
Change Representation
Transform and Conquer
Horner’s Rule
67
Multiply by coefficients
Complication:
O(n2)
Transform and Conquer
Horner’s Rule
68Transform and Conquer
Horner’s Rule
69Transform and Conquer
70
Algorithm:
Complication: T(n) = O(n)
0
i+1
i + 1
i < n
Horner’s Rule
Transform and Conquer
• 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
LCM(m,n)
72Transform and Conquer
The smallest integer that is divisible by both m and n
LCM(m,n)
73Transform and Conquer
LCM(m,n)
74Transform and Conquer
LCM(m,n)
75Transform and Conquer
Calculate GCD using Euclid’s Algorithm
LCM(m,n)
76Transform and Conquer
LCM(m,n)
77Transform and Conquer
Euclid’s Algorithm
Problem Reduction
Resources
78Transform and Conquer
Algorithms_design and analysis [Harsh Bhasin] chapter 15.
Levitin A.-Introduction to the design and analysis of
algorithms-AW (2011) [Anany Levitin] chapter 6.
Transform and Conquer 79
Thanks for your listening

More Related Content

What's hot

Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Simplilearn
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
Associative Classification: Synopsis
Associative Classification: SynopsisAssociative Classification: Synopsis
Associative Classification: Synopsis
Jagdeep Singh Malhi
 

What's hot (20)

Support vector machine-SVM's
Support vector machine-SVM'sSupport vector machine-SVM's
Support vector machine-SVM's
 
Data mining query language
Data mining query languageData mining query language
Data mining query language
 
Oracle sql joins
Oracle sql joinsOracle sql joins
Oracle sql joins
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learning
 
N queen problem
N queen problemN queen problem
N queen problem
 
Sql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and TricksSql Server Management Studio Tips and Tricks
Sql Server Management Studio Tips and Tricks
 
Mysql
MysqlMysql
Mysql
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Database presentation
Database presentationDatabase presentation
Database presentation
 
Svm and kernel machines
Svm and kernel machinesSvm and kernel machines
Svm and kernel machines
 
Java Linked List Tutorial | Edureka
Java Linked List Tutorial |  EdurekaJava Linked List Tutorial |  Edureka
Java Linked List Tutorial | Edureka
 
Binary tree traversal ppt
Binary tree traversal pptBinary tree traversal ppt
Binary tree traversal ppt
 
Associative Classification: Synopsis
Associative Classification: SynopsisAssociative Classification: Synopsis
Associative Classification: Synopsis
 
Linear regression in machine learning
Linear regression in machine learningLinear regression in machine learning
Linear regression in machine learning
 
Trigger in DBMS
Trigger in DBMSTrigger in DBMS
Trigger in DBMS
 
Recursion
RecursionRecursion
Recursion
 

Similar to Advanced Algorithms: Transform and conquer

10 merge sort
10 merge sort10 merge sort
10 merge sort
irdginfo
 
MATRICES AND CALCULUS.pptx
MATRICES AND CALCULUS.pptxMATRICES AND CALCULUS.pptx
MATRICES AND CALCULUS.pptx
massm99m
 

Similar to Advanced Algorithms: Transform and conquer (20)

02 - Discrete-Time Markov Models - incomplete.pptx
02 - Discrete-Time Markov Models - incomplete.pptx02 - Discrete-Time Markov Models - incomplete.pptx
02 - Discrete-Time Markov Models - incomplete.pptx
 
Basic Calculus Basic Differentiation Rules
Basic Calculus Basic Differentiation RulesBasic Calculus Basic Differentiation Rules
Basic Calculus Basic Differentiation Rules
 
Algorithm - Mergesort & Quicksort
Algorithm - Mergesort & Quicksort Algorithm - Mergesort & Quicksort
Algorithm - Mergesort & Quicksort
 
2.6 Other Types of Equations
2.6 Other Types of Equations2.6 Other Types of Equations
2.6 Other Types of Equations
 
Short notes on mathematics
Short notes on mathematicsShort notes on mathematics
Short notes on mathematics
 
10 merge sort
10 merge sort10 merge sort
10 merge sort
 
0.7 Radical Expressions
0.7 Radical Expressions0.7 Radical Expressions
0.7 Radical Expressions
 
L4 Solving Equations that are Transformable into Quadratic Equations.pptx
L4 Solving Equations that are Transformable into Quadratic Equations.pptxL4 Solving Equations that are Transformable into Quadratic Equations.pptx
L4 Solving Equations that are Transformable into Quadratic Equations.pptx
 
CSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.pptCSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.ppt
 
Rational equation ex
Rational equation exRational equation ex
Rational equation ex
 
jake.pptx
jake.pptxjake.pptx
jake.pptx
 
Integral and Differential CalculusI.pptx
Integral and Differential CalculusI.pptxIntegral and Differential CalculusI.pptx
Integral and Differential CalculusI.pptx
 
Group No 05, calculus.pptx
Group No 05, calculus.pptxGroup No 05, calculus.pptx
Group No 05, calculus.pptx
 
Calculus
CalculusCalculus
Calculus
 
P1-07-Recurrences.pdf
P1-07-Recurrences.pdfP1-07-Recurrences.pdf
P1-07-Recurrences.pdf
 
E2
E2E2
E2
 
Z transfrm ppt
Z transfrm pptZ transfrm ppt
Z transfrm ppt
 
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - System Models
Lecture Notes:  EEEC4340318 Instrumentation and Control Systems - System ModelsLecture Notes:  EEEC4340318 Instrumentation and Control Systems - System Models
Lecture Notes: EEEC4340318 Instrumentation and Control Systems - System Models
 
Exponent review
Exponent reviewExponent review
Exponent review
 
MATRICES AND CALCULUS.pptx
MATRICES AND CALCULUS.pptxMATRICES AND CALCULUS.pptx
MATRICES AND CALCULUS.pptx
 

More from Abdulrazak Zakieh

More from Abdulrazak Zakieh (7)

Convolutional Neural Network (CNN)
Convolutional Neural Network (CNN)Convolutional Neural Network (CNN)
Convolutional Neural Network (CNN)
 
البريد الإلكتروني والبروتوكولات المستخدمة في الإرسال والاستقبال
البريد الإلكتروني والبروتوكولات المستخدمة في الإرسال والاستقبالالبريد الإلكتروني والبروتوكولات المستخدمة في الإرسال والاستقبال
البريد الإلكتروني والبروتوكولات المستخدمة في الإرسال والاستقبال
 
Hiding data into digital images (Steganography)
Hiding data into digital images (Steganography)Hiding data into digital images (Steganography)
Hiding data into digital images (Steganography)
 
Introduction to Deep learning
Introduction to Deep learningIntroduction to Deep learning
Introduction to Deep learning
 
برنامج محادثة باستخدام الاستدعاء العكسي بلغة الجافا
برنامج محادثة باستخدام الاستدعاء العكسي بلغة الجافابرنامج محادثة باستخدام الاستدعاء العكسي بلغة الجافا
برنامج محادثة باستخدام الاستدعاء العكسي بلغة الجافا
 
برنامج محادثة باستخدام الاستدعاء العكسي في استدعاء الطرق البعيدة بلغة الجافا ...
برنامج محادثة باستخدام الاستدعاء العكسي في استدعاء الطرق البعيدة بلغة الجافا ...برنامج محادثة باستخدام الاستدعاء العكسي في استدعاء الطرق البعيدة بلغة الجافا ...
برنامج محادثة باستخدام الاستدعاء العكسي في استدعاء الطرق البعيدة بلغة الجافا ...
 
The 555 timer
The 555 timerThe 555 timer
The 555 timer
 

Recently uploaded

DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DrGurudutt
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 

Recently uploaded (20)

DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Quiz application system project report..pdf
Quiz application system project report..pdfQuiz application system project report..pdf
Quiz application system project report..pdf
 
solid state electronics ktu module 5 slides
solid state electronics ktu module 5 slidessolid state electronics ktu module 5 slides
solid state electronics ktu module 5 slides
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWINGBRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
 
E-Commerce Shopping using MERN Stack where different modules are present
E-Commerce Shopping using MERN Stack where different modules are presentE-Commerce Shopping using MERN Stack where different modules are present
E-Commerce Shopping using MERN Stack where different modules are present
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Electrical shop management system project report.pdf
Electrical shop management system project report.pdfElectrical shop management system project report.pdf
Electrical shop management system project report.pdf
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 

Advanced Algorithms: Transform and conquer

Editor's Notes

  1. 24 = 2.2.2.3, 60 = 2.2.3.5, lcm = 120