2
Most read
3
Most read
9
Most read
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

PPTX
Lecture 18 simplified memory bound a star algorithm
PPTX
Policy Enforcement on Kubernetes with Open Policy Agent
PDF
Java notes | All Basics |
PDF
Derbycon - The Unintended Risks of Trusting Active Directory
PPTX
Python Programming Essentials - M20 - Classes and Objects
PDF
Approximation Algorithms
PDF
DerbyCon 2019 - Kerberoasting Revisited
PPTX
Access Modifier.pptx
Lecture 18 simplified memory bound a star algorithm
Policy Enforcement on Kubernetes with Open Policy Agent
Java notes | All Basics |
Derbycon - The Unintended Risks of Trusting Active Directory
Python Programming Essentials - M20 - Classes and Objects
Approximation Algorithms
DerbyCon 2019 - Kerberoasting Revisited
Access Modifier.pptx

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

PPTX
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
PPTX
Undecidable Problems and Approximation Algorithms
PPT
BackTracking Algorithm: Technique and Examples
PPTX
Chapter 5.pptx
PPTX
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
PPTX
Unit 2 algorithm
PDF
DAA Notes.pdf
PPT
Sudoku
PPTX
Design and Analysis of Algorithm for II year Computer science and Engineering...
PDF
Introduction to Algorithm Design and Analysis.pdf
PPTX
DAA 1 ppt.pptx
PPTX
DAA ppt.pptx
PDF
01 CS316_Introduction.pdf5959695559655565
PPT
Greedy algorithm pptxe file for computer
PDF
Sienna 1 intro
PDF
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
PDF
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems and Approximation Algorithms
BackTracking Algorithm: Technique and Examples
Chapter 5.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
Unit 2 algorithm
DAA Notes.pdf
Sudoku
Design and Analysis of Algorithm for II year Computer science and Engineering...
Introduction to Algorithm Design and Analysis.pdf
DAA 1 ppt.pptx
DAA ppt.pptx
01 CS316_Introduction.pdf5959695559655565
Greedy algorithm pptxe file for computer
Sienna 1 intro
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Ad

Recently uploaded (20)

PDF
Civil Department's presentation Your score increases as you pick a category
PDF
PowerPoint for Climate Change by T.T.pdf
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
semiconductor packaging in vlsi design fab
PPTX
DRUGS USED FOR HORMONAL DISORDER, SUPPLIMENTATION, CONTRACEPTION, & MEDICAL T...
PDF
English Textual Question & Ans (12th Class).pdf
PDF
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
Climate and Adaptation MCQs class 7 from chatgpt
PDF
International_Financial_Reporting_Standa.pdf
PDF
M.Tech in Aerospace Engineering | BIT Mesra
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PPTX
INSTRUMENT AND INSTRUMENTATION PRESENTATION
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
IP : I ; Unit I : Preformulation Studies
PDF
Journal of Dental Science - UDMY (2022).pdf
Civil Department's presentation Your score increases as you pick a category
PowerPoint for Climate Change by T.T.pdf
What’s under the hood: Parsing standardized learning content for AI
semiconductor packaging in vlsi design fab
DRUGS USED FOR HORMONAL DISORDER, SUPPLIMENTATION, CONTRACEPTION, & MEDICAL T...
English Textual Question & Ans (12th Class).pdf
1.Salivary gland disease.pdf 3.Bleeding and Clotting Disorders.pdf important
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Everyday Spelling and Grammar by Kathi Wyldeck
Core Concepts of Personalized Learning and Virtual Learning Environments
Climate and Adaptation MCQs class 7 from chatgpt
International_Financial_Reporting_Standa.pdf
M.Tech in Aerospace Engineering | BIT Mesra
Journal of Dental Science - UDMY (2021).pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
INSTRUMENT AND INSTRUMENTATION PRESENTATION
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
IP : I ; Unit I : Preformulation Studies
Journal of Dental Science - UDMY (2022).pdf
Ad

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.