SlideShare a Scribd company logo
Design and Analysis of
Algorithms
Course Outline
1. Introduction to Algorithms
2. Mathematical Preliminaries
3. Growth Functions
4. Recurrences
5. Overview of Data Structures
6. Sorting and Searching Algorithms
7. Tree Algorithms
8. Graph Algorithms
9. Strings and Pattern Matching
10. Dynamic Programming
11. Theory of NP-Completeness
Reference Books
1. T. Corman, E. Leiserson, L. Rivest, C. Stein, Introduction to
Algorithms, 3rd Edition, Prentice Hall
2. R. Sedgewik, P. Flajolet, An Introduction to the Analysis of
Algorithms, 2nd Edition, Addison-Wesley
3. A. Levitin, Introduction to Design and Analysis of Algorithms, 3rd
Edition, Pearson Education Inc
Introduction to Algorithms
Algorithms - History
• Procedures for solving geometric and arithmetic problems were formulated by ancient
Greeks.
• Some two thousands years ago, the celebrated procedure for finding greatest
common divisor (g c d) was discovered by Euclid.
• In tenth century, Persian mathematician Muhammad- inbne- Musa Al lkowarzimi
stated procedures for solving algebraic equations. The procedure are described in his
famous book Kitab al Jabr wa’l muqabla (‘Rules of restoring and equating’).
The word algorithm is coined from Alkhowarizm
• In the mid- twentieth century D.E. Knuth undertook in depth study and analysis of
algorithms. His work is embodied in the comprehensive book ‘Art of Computer
Programming’, which serves as foundation for modern study of algorithms.
Algorithms – Formal Definition
An algorithm is an orderly step-by-step procedure, which has the
characteristics:
1) It accepts one or more input value
2) It returns at least one output value
3) It terminates after finite steps
Algorithms – Applications
• Sorting Algorithms (Elementary and Advanced)
• Searching Algorithms (Linear and Non-linear)
• Strings Processing ( Pattern matching, Parsing, Compression,
Cryptography)
• Image Processing ( Compression, Matching, Conversion)
• Mathematical Algorithms (Random number generator, matrix
operations, FFT, etc)
Algorithms – Classic Problems
• Hamiltonian Circuit Problem
• Traveling Salesperson Problem
• Graph Coloring Problem
• The Sum-Set Problem
• The n-Queen Problem
Hamiltonian Circuit Problem
Problem: Determine if a given graph has a Hamiltonian circuit.
• A Hamiltonian circuit , also called tour, is path that starts and ends at
the same vertex, and passes through all other vertices exactly once.
• A graph can have more than one Hamiltonian circuit, or none at all.
Traveling Salesperson Problem
Problem(a): A salesperson has to travel to n cities, such he starts at one city
and ends up at the same city, visits each city exactly once , and covers
minimum distance.
Problem(b): Determine minimum tour for a graph with n vertices.
Graph Coloring Problem
• Problem :. For given graph, find the minimum number of colors that can be
used to color the vertices so that no two adjacent vertices have the same
color.
Graph Coloring Problem
• Problem :. For given graph, find the minimum number of colors that can be
used to color the vertices so that no two adjacent vertices have the same
color.
Sum of Subset Problem
Problem : Given a set of set S = {s1, s2, s3, … sn} of n positive integers and an
integer w, find all subsets of S such that sum of integers, in each subset, equals
w.
Suppose S = {s1, s2, s3, s4, s5}
Let s1=5, s2 = 6, s3 = 10, s4 = 11 ,s5 = 16, and w = 21
• s3 + s4 = 10 + 11 = 21
In general, for a set of n integers, there are 2n subsets need to be examined.
For example, for n=20, the number of subsets is 220 = 1,048,576
Sum of Subset Problem
Problem : Given a set of set S = {s1, s2, s3, … sn} of n positive integers and an
integer w, find all subsets of S such that sum of integers, in each subset, equals
w.
Suppose S = {s1, s2, s3, s4, s5}
Let s1=5, s2 = 6, s3 = 10, s4 = 11 ,s5 = 16, and w = 21
• s1 + s2 + s3 = 5 + 6 + 10 =21
• s1 + s5 = 5 + 16 = 21
• s3 + s4 = 10 + 11 = 21
In general, for a set of n integers, there are 2n subsets need to be examined.
For example, for n=20, the number of subsets is 220 = 1,048,576
n-Queen Problem
Problem : n queens are to be placed on an n by n chessboard so that no two
queens threat each other. A queen threats another queen if is on the same row,
or same column, or same diagonal of the chess board.
Algorithm Design
• Divide-and-Conquer Algorithm
• Greedy Algorithm
• Backtracking Algorithm
• Dynamic Programming
• Brute Force
• Approximation Algorithm
• Randomized Algorithm
Divide-and-Conquer Algorithm
The divide and conquer algorithm has the following approach:
1) The problem is split (divided) into two distinct independent sub problems
2) The sub problems are solved (conquered) separately
3) The solutions to the sub problems are merged together to obtain solution to
main problem.
Divide-and-Conquer Algorithm
Problem: Sort the set of numbers {25,10, 8, 45, 67, 33, 20, 59} in ascending
order.
Divide-and-Conquer Algorithm
• Quick Sort
• Merge Sort
• Binary Search
• Multiplication of Large Integers
• Matrix Multiplication
• Fast Fourier Transform
Divide-and-Conquer Algorithm
Divide and conquer algorithm provides efficient sorting and searching methods.
It, however, has following limitations:
• The divide-and-conquer algorithm is implemented using recursive function
calls, which is not supported by some of the programming languages.
• Recursive calls need large stacks to store intermediate results, utilize
computer’s special memory called heap which may not be available on some
systems and decrease data access speed
• The divide-and-conquer algorithm is in-efficient when sub problems are not
of nearly equal size.
Greedy Algorithm
Greedy Algorithm is designed to solve optimization problems. The greedy algorithm
has the follows approach:
1) The problem is solved in steps. At each step, several choices are available for
partial solutions. A greedy choice is made by selecting the option with maximum
( or minimum) cost. This is referred to as locally optimum solution, as opposed
to globally optimum solution, which is expected to be the overall optimum
solution.
2) It is checked if the selected option satisfies problems constraint ( for example, the
cost does not exceed the prescribed limit ).This is referred to as feasible solution.
3) If current solution is not feasible, the next best option is selected.
4) Once a choice is made, it is not changed in subsequent steps. This condition is
referred to as irrevocability
Greedy Algorithm
Problem: ATM is to deliver a change for Rs. 98, with minimum number of
currency notes/coins.
Greedy Algorithm
Minimum Cabling in network
• Prim’s Algorithm
• Kruskal’s Algorithm
Shortest route in a network
• Dijkstara Algorithm
Huffman coding for text compression
Optimum Job Scheduling
Greedy Algorithm
The greedy algorithm provides is a simple and elegant solution to optimization
problems. It has, however, the following limitations:
• The greedy algorithm does not always produce a globally optimum solution ,
(for example, in case of traveling salesperson problem).
• In order to check whether or not the resulting solution is optimal, further
analysis is required.
• Often the analysis for globally optimum solution is quite complex.
• Analysis may requires additional resources.

More Related Content

What's hot

Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -
Rai University
 
MATRICES
MATRICESMATRICES
MATRICESdaferro
 
System of linear algebriac equations nsm
System of linear algebriac equations nsmSystem of linear algebriac equations nsm
System of linear algebriac equations nsm
Rahul Narang
 
Matrix algebra
Matrix algebraMatrix algebra
Matrix algebra
Farzad Javidanrad
 
matricesMrtices
matricesMrticesmatricesMrtices
matricesMrtices
Yourskill Tricks
 
Chapter 4: Linear Algebraic Equations
Chapter 4: Linear Algebraic EquationsChapter 4: Linear Algebraic Equations
Chapter 4: Linear Algebraic EquationsMaria Fernanda
 
Introduction to matices
Introduction to maticesIntroduction to matices
Introduction to matices
Raza Tuition center
 
Matrices
MatricesMatrices
Matrix chain multiplication
Matrix chain multiplicationMatrix chain multiplication
Matrix chain multiplication
Respa Peter
 
Lecture 5 inverse of matrices - section 2-2 and 2-3
Lecture 5   inverse of matrices - section 2-2 and 2-3Lecture 5   inverse of matrices - section 2-2 and 2-3
Lecture 5 inverse of matrices - section 2-2 and 2-3
njit-ronbrown
 
Matrices ppt
Matrices pptMatrices ppt
Matrices ppt
aakashray33
 
Parametric versus semi nonparametric parametric regression models
Parametric versus semi nonparametric parametric regression modelsParametric versus semi nonparametric parametric regression models
Parametric versus semi nonparametric parametric regression models
Nuriye Sancar
 
Matrix.
Matrix.Matrix.
Matrix.
Awais Bakshy
 
Singular and non singular matrix
Singular and non singular matrixSingular and non singular matrix
Singular and non singular matrix
Muhammad Umar Farooq
 
Direct Methods For The Solution Of Systems Of
Direct Methods For The Solution Of Systems OfDirect Methods For The Solution Of Systems Of
Direct Methods For The Solution Of Systems Of
Marcela Carrillo
 
Matrices and determinants
Matrices and determinantsMatrices and determinants
Matrices and determinants
som allul
 
Linear inequalities in two variables
Linear inequalities in two variablesLinear inequalities in two variables
Linear inequalities in two variables
christianjustine
 
Matrices
MatricesMatrices
MatricesNORAIMA
 

What's hot (19)

Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -Bba i-bm-u-2- matrix -
Bba i-bm-u-2- matrix -
 
MATRICES
MATRICESMATRICES
MATRICES
 
System of linear algebriac equations nsm
System of linear algebriac equations nsmSystem of linear algebriac equations nsm
System of linear algebriac equations nsm
 
Matrix algebra
Matrix algebraMatrix algebra
Matrix algebra
 
matricesMrtices
matricesMrticesmatricesMrtices
matricesMrtices
 
Chapter 4: Linear Algebraic Equations
Chapter 4: Linear Algebraic EquationsChapter 4: Linear Algebraic Equations
Chapter 4: Linear Algebraic Equations
 
Introduction to matices
Introduction to maticesIntroduction to matices
Introduction to matices
 
Matrices
MatricesMatrices
Matrices
 
Matrix chain multiplication
Matrix chain multiplicationMatrix chain multiplication
Matrix chain multiplication
 
Lecture 5 inverse of matrices - section 2-2 and 2-3
Lecture 5   inverse of matrices - section 2-2 and 2-3Lecture 5   inverse of matrices - section 2-2 and 2-3
Lecture 5 inverse of matrices - section 2-2 and 2-3
 
Matrices ppt
Matrices pptMatrices ppt
Matrices ppt
 
Introduction of matrices
Introduction of matricesIntroduction of matrices
Introduction of matrices
 
Parametric versus semi nonparametric parametric regression models
Parametric versus semi nonparametric parametric regression modelsParametric versus semi nonparametric parametric regression models
Parametric versus semi nonparametric parametric regression models
 
Matrix.
Matrix.Matrix.
Matrix.
 
Singular and non singular matrix
Singular and non singular matrixSingular and non singular matrix
Singular and non singular matrix
 
Direct Methods For The Solution Of Systems Of
Direct Methods For The Solution Of Systems OfDirect Methods For The Solution Of Systems Of
Direct Methods For The Solution Of Systems Of
 
Matrices and determinants
Matrices and determinantsMatrices and determinants
Matrices and determinants
 
Linear inequalities in two variables
Linear inequalities in two variablesLinear inequalities in two variables
Linear inequalities in two variables
 
Matrices
MatricesMatrices
Matrices
 

Similar to Data Analysis and Algorithms Lecture 1: Introduction

Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
muthukrishnavinayaga
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
Muthu Vinayagam
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
Chapter 5.pptx
Chapter 5.pptxChapter 5.pptx
Chapter 5.pptx
Tekle12
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
B.T.L.I.T
 
Unit 2 algorithm
Unit   2 algorithmUnit   2 algorithm
Unit 2 algorithm
Dabbal Singh Mahara
 
DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
SauravPawar14
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
RAJESH S
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
RAJESH S
 
Greedy algorithm pptxe file for computer
Greedy algorithm pptxe file for computerGreedy algorithm pptxe file for computer
Greedy algorithm pptxe file for computer
kerimu1235
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 introchidabdu
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdfLec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
MAJDABDALLAH3
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
22bcs058
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
hodcsencet
 
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal's
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal'sGreedy algorithms -Making change-Knapsack-Prim's-Kruskal's
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal's
Jay Patel
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 

Similar to Data Analysis and Algorithms Lecture 1: Introduction (20)

Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Approximation Algorithms TSP
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Back tracking
Back trackingBack tracking
Back tracking
 
Chapter 5.pptx
Chapter 5.pptxChapter 5.pptx
Chapter 5.pptx
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
 
Unit 2 algorithm
Unit   2 algorithmUnit   2 algorithm
Unit 2 algorithm
 
DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
 
Greedy algorithm pptxe file for computer
Greedy algorithm pptxe file for computerGreedy algorithm pptxe file for computer
Greedy algorithm pptxe file for computer
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 intro
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdfLec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal's
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal'sGreedy algorithms -Making change-Knapsack-Prim's-Kruskal's
Greedy algorithms -Making change-Knapsack-Prim's-Kruskal's
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 

Recently uploaded

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 

Recently uploaded (20)

Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 

Data Analysis and Algorithms Lecture 1: Introduction

  • 1. Design and Analysis of Algorithms
  • 2. Course Outline 1. Introduction to Algorithms 2. Mathematical Preliminaries 3. Growth Functions 4. Recurrences 5. Overview of Data Structures 6. Sorting and Searching Algorithms 7. Tree Algorithms 8. Graph Algorithms 9. Strings and Pattern Matching 10. Dynamic Programming 11. Theory of NP-Completeness
  • 3. Reference Books 1. T. Corman, E. Leiserson, L. Rivest, C. Stein, Introduction to Algorithms, 3rd Edition, Prentice Hall 2. R. Sedgewik, P. Flajolet, An Introduction to the Analysis of Algorithms, 2nd Edition, Addison-Wesley 3. A. Levitin, Introduction to Design and Analysis of Algorithms, 3rd Edition, Pearson Education Inc
  • 5. Algorithms - History • Procedures for solving geometric and arithmetic problems were formulated by ancient Greeks. • Some two thousands years ago, the celebrated procedure for finding greatest common divisor (g c d) was discovered by Euclid. • In tenth century, Persian mathematician Muhammad- inbne- Musa Al lkowarzimi stated procedures for solving algebraic equations. The procedure are described in his famous book Kitab al Jabr wa’l muqabla (‘Rules of restoring and equating’). The word algorithm is coined from Alkhowarizm • In the mid- twentieth century D.E. Knuth undertook in depth study and analysis of algorithms. His work is embodied in the comprehensive book ‘Art of Computer Programming’, which serves as foundation for modern study of algorithms.
  • 6. Algorithms – Formal Definition An algorithm is an orderly step-by-step procedure, which has the characteristics: 1) It accepts one or more input value 2) It returns at least one output value 3) It terminates after finite steps
  • 7. Algorithms – Applications • Sorting Algorithms (Elementary and Advanced) • Searching Algorithms (Linear and Non-linear) • Strings Processing ( Pattern matching, Parsing, Compression, Cryptography) • Image Processing ( Compression, Matching, Conversion) • Mathematical Algorithms (Random number generator, matrix operations, FFT, etc)
  • 8. Algorithms – Classic Problems • Hamiltonian Circuit Problem • Traveling Salesperson Problem • Graph Coloring Problem • The Sum-Set Problem • The n-Queen Problem
  • 9. Hamiltonian Circuit Problem Problem: Determine if a given graph has a Hamiltonian circuit. • A Hamiltonian circuit , also called tour, is path that starts and ends at the same vertex, and passes through all other vertices exactly once. • A graph can have more than one Hamiltonian circuit, or none at all.
  • 10. Traveling Salesperson Problem Problem(a): A salesperson has to travel to n cities, such he starts at one city and ends up at the same city, visits each city exactly once , and covers minimum distance. Problem(b): Determine minimum tour for a graph with n vertices.
  • 11. Graph Coloring Problem • Problem :. For given graph, find the minimum number of colors that can be used to color the vertices so that no two adjacent vertices have the same color.
  • 12. Graph Coloring Problem • Problem :. For given graph, find the minimum number of colors that can be used to color the vertices so that no two adjacent vertices have the same color.
  • 13. Sum of Subset Problem Problem : Given a set of set S = {s1, s2, s3, … sn} of n positive integers and an integer w, find all subsets of S such that sum of integers, in each subset, equals w. Suppose S = {s1, s2, s3, s4, s5} Let s1=5, s2 = 6, s3 = 10, s4 = 11 ,s5 = 16, and w = 21 • s3 + s4 = 10 + 11 = 21 In general, for a set of n integers, there are 2n subsets need to be examined. For example, for n=20, the number of subsets is 220 = 1,048,576
  • 14. Sum of Subset Problem Problem : Given a set of set S = {s1, s2, s3, … sn} of n positive integers and an integer w, find all subsets of S such that sum of integers, in each subset, equals w. Suppose S = {s1, s2, s3, s4, s5} Let s1=5, s2 = 6, s3 = 10, s4 = 11 ,s5 = 16, and w = 21 • s1 + s2 + s3 = 5 + 6 + 10 =21 • s1 + s5 = 5 + 16 = 21 • s3 + s4 = 10 + 11 = 21 In general, for a set of n integers, there are 2n subsets need to be examined. For example, for n=20, the number of subsets is 220 = 1,048,576
  • 15. n-Queen Problem Problem : n queens are to be placed on an n by n chessboard so that no two queens threat each other. A queen threats another queen if is on the same row, or same column, or same diagonal of the chess board.
  • 16. Algorithm Design • Divide-and-Conquer Algorithm • Greedy Algorithm • Backtracking Algorithm • Dynamic Programming • Brute Force • Approximation Algorithm • Randomized Algorithm
  • 17. Divide-and-Conquer Algorithm The divide and conquer algorithm has the following approach: 1) The problem is split (divided) into two distinct independent sub problems 2) The sub problems are solved (conquered) separately 3) The solutions to the sub problems are merged together to obtain solution to main problem.
  • 18. Divide-and-Conquer Algorithm Problem: Sort the set of numbers {25,10, 8, 45, 67, 33, 20, 59} in ascending order.
  • 19. Divide-and-Conquer Algorithm • Quick Sort • Merge Sort • Binary Search • Multiplication of Large Integers • Matrix Multiplication • Fast Fourier Transform
  • 20. Divide-and-Conquer Algorithm Divide and conquer algorithm provides efficient sorting and searching methods. It, however, has following limitations: • The divide-and-conquer algorithm is implemented using recursive function calls, which is not supported by some of the programming languages. • Recursive calls need large stacks to store intermediate results, utilize computer’s special memory called heap which may not be available on some systems and decrease data access speed • The divide-and-conquer algorithm is in-efficient when sub problems are not of nearly equal size.
  • 21. Greedy Algorithm Greedy Algorithm is designed to solve optimization problems. The greedy algorithm has the follows approach: 1) The problem is solved in steps. At each step, several choices are available for partial solutions. A greedy choice is made by selecting the option with maximum ( or minimum) cost. This is referred to as locally optimum solution, as opposed to globally optimum solution, which is expected to be the overall optimum solution. 2) It is checked if the selected option satisfies problems constraint ( for example, the cost does not exceed the prescribed limit ).This is referred to as feasible solution. 3) If current solution is not feasible, the next best option is selected. 4) Once a choice is made, it is not changed in subsequent steps. This condition is referred to as irrevocability
  • 22. Greedy Algorithm Problem: ATM is to deliver a change for Rs. 98, with minimum number of currency notes/coins.
  • 23. Greedy Algorithm Minimum Cabling in network • Prim’s Algorithm • Kruskal’s Algorithm Shortest route in a network • Dijkstara Algorithm Huffman coding for text compression Optimum Job Scheduling
  • 24. Greedy Algorithm The greedy algorithm provides is a simple and elegant solution to optimization problems. It has, however, the following limitations: • The greedy algorithm does not always produce a globally optimum solution , (for example, in case of traveling salesperson problem). • In order to check whether or not the resulting solution is optimal, further analysis is required. • Often the analysis for globally optimum solution is quite complex. • Analysis may requires additional resources.