SlideShare a Scribd company logo
2
Most read
3
Most read
8
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.
Ad

Recommended

Binary search
Binary search
Gaurav Solanki
 
Linked list
Linked list
MahammadAdil
 
Splay Tree
Splay Tree
Dr Sandeep Kumar Poonia
 
Cs8792 cns - Public key cryptosystem (Unit III)
Cs8792 cns - Public key cryptosystem (Unit III)
ArthyR3
 
Activation function
Activation function
RakshithGowdakodihal
 
Chap4
Chap4
nathanurag
 
Modern Block Cipher- Modern Symmetric-Key Cipher
Modern Block Cipher- Modern Symmetric-Key Cipher
Mahbubur Rahman
 
Message Authentication Code & HMAC
Message Authentication Code & HMAC
Krishna Gehlot
 
Important 16 marks questions
Important 16 marks questions
vaidheeswari
 
Quicksort Presentation
Quicksort Presentation
irdginfo
 
Authentication Protocols
Authentication Protocols
Trinity Dwarka
 
Machine Learning Ch 1.ppt
Machine Learning Ch 1.ppt
ARVIND SARDAR
 
Artificial Neural Network
Artificial Neural Network
Prakash K
 
1.8 splay tree
1.8 splay tree
Krish_ver2
 
Feed Forward Neural Network.pptx
Feed Forward Neural Network.pptx
NoorFathima60
 
Ppt bubble sort
Ppt bubble sort
prabhakar jalasutram
 
ML - Simple Linear Regression
ML - Simple Linear Regression
Andrew Ferlitsch
 
Greedy algorithm
Greedy algorithm
International Islamic University
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
Query Decomposition and data localization
Query Decomposition and data localization
Hafiz faiz
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
Shubham Jaybhaye
 
2.2 decision tree
2.2 decision tree
Krish_ver2
 
Quick sort
Quick sort
AreenGaur
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
Vishal Tandel
 
Information and network security 9 model for network security
Information and network security 9 model for network security
Vaibhav Khanna
 
Red black trees
Red black trees
mumairsadiq
 
The propositional calculus
The propositional calculus
Anju Kanjirathingal
 
k Nearest Neighbor
k Nearest Neighbor
butest
 
Algorithms
Algorithms
Ramy F. Radwan
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 

More Related Content

What's hot (20)

Important 16 marks questions
Important 16 marks questions
vaidheeswari
 
Quicksort Presentation
Quicksort Presentation
irdginfo
 
Authentication Protocols
Authentication Protocols
Trinity Dwarka
 
Machine Learning Ch 1.ppt
Machine Learning Ch 1.ppt
ARVIND SARDAR
 
Artificial Neural Network
Artificial Neural Network
Prakash K
 
1.8 splay tree
1.8 splay tree
Krish_ver2
 
Feed Forward Neural Network.pptx
Feed Forward Neural Network.pptx
NoorFathima60
 
Ppt bubble sort
Ppt bubble sort
prabhakar jalasutram
 
ML - Simple Linear Regression
ML - Simple Linear Regression
Andrew Ferlitsch
 
Greedy algorithm
Greedy algorithm
International Islamic University
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
Query Decomposition and data localization
Query Decomposition and data localization
Hafiz faiz
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
Shubham Jaybhaye
 
2.2 decision tree
2.2 decision tree
Krish_ver2
 
Quick sort
Quick sort
AreenGaur
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
Vishal Tandel
 
Information and network security 9 model for network security
Information and network security 9 model for network security
Vaibhav Khanna
 
Red black trees
Red black trees
mumairsadiq
 
The propositional calculus
The propositional calculus
Anju Kanjirathingal
 
k Nearest Neighbor
k Nearest Neighbor
butest
 
Important 16 marks questions
Important 16 marks questions
vaidheeswari
 
Quicksort Presentation
Quicksort Presentation
irdginfo
 
Authentication Protocols
Authentication Protocols
Trinity Dwarka
 
Machine Learning Ch 1.ppt
Machine Learning Ch 1.ppt
ARVIND SARDAR
 
Artificial Neural Network
Artificial Neural Network
Prakash K
 
1.8 splay tree
1.8 splay tree
Krish_ver2
 
Feed Forward Neural Network.pptx
Feed Forward Neural Network.pptx
NoorFathima60
 
ML - Simple Linear Regression
ML - Simple Linear Regression
Andrew Ferlitsch
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
Fahim Ferdous
 
Query Decomposition and data localization
Query Decomposition and data localization
Hafiz faiz
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
Shubham Jaybhaye
 
2.2 decision tree
2.2 decision tree
Krish_ver2
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
Vishal Tandel
 
Information and network security 9 model for network security
Information and network security 9 model for network security
Vaibhav Khanna
 
k Nearest Neighbor
k Nearest Neighbor
butest
 

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

Algorithms
Algorithms
Ramy F. Radwan
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 
Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1
Techglyphs
 
35 algorithm-types
35 algorithm-types
Kislay Bhardwaj L|PT,ECSA,C|EH
 
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
DrKBManwade
 
Algorithms
Algorithms
suzzanj1990
 
ADA complete notes
ADA complete notes
Vinay Kumar C
 
35 algorithm-types
35 algorithm-types
ashish bansal
 
algorithm-types.ppt
algorithm-types.ppt
TusharSharma759024
 
35-algorithm-types.ppt
35-algorithm-types.ppt
HarikumarRajandran1
 
35 algorithm-types
35 algorithm-types
EducationalJunction
 
Algorithm review
Algorithm review
chidabdu
 
Types of algorithms
Types of algorithms
Amelita Martinez
 
Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer key
appasami
 
Algorithm types
Algorithm types
JavariaIbrahim
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
MAJDABDALLAH3
 
Skiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithms
zukun
 
Algo Strategies and explaination ppt.pdf
Algo Strategies and explaination ppt.pdf
sayalishivarkar1
 
Cs6402 scad-msm
Cs6402 scad-msm
Jai Ram
 
Algorithms
Algorithms
WaqarzadAa
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 
Bt0080 fundamentals of algorithms1
Bt0080 fundamentals of algorithms1
Techglyphs
 
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
daa_unit THIS IS GNDFJG SDGSGS SFDF .ppt
DrKBManwade
 
Algorithm review
Algorithm review
chidabdu
 
Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer key
appasami
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
MAJDABDALLAH3
 
Skiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithms
zukun
 
Algo Strategies and explaination ppt.pdf
Algo Strategies and explaination ppt.pdf
sayalishivarkar1
 
Cs6402 scad-msm
Cs6402 scad-msm
Jai Ram
 
Ad

Recently uploaded (20)

NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDM Recording Presents Yogi Goddess by LDMMIA
LDM Recording Presents Yogi Goddess by LDMMIA
LDM & Mia eStudios
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
Nutrition Assessment and Nutrition Education – Unit 4 | B.Sc Nursing 5th Seme...
Nutrition Assessment and Nutrition Education – Unit 4 | B.Sc Nursing 5th Seme...
RAKESH SAJJAN
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
Community Health Nursing Approaches, Concepts, Roles & Responsibilities – Uni...
RAKESH SAJJAN
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
How payment terms are configured in Odoo 18
How payment terms are configured in Odoo 18
Celine George
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDM Recording Presents Yogi Goddess by LDMMIA
LDM Recording Presents Yogi Goddess by LDMMIA
LDM & Mia eStudios
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
Nutrition Assessment and Nutrition Education – Unit 4 | B.Sc Nursing 5th Seme...
Nutrition Assessment and Nutrition Education – Unit 4 | B.Sc Nursing 5th Seme...
RAKESH SAJJAN
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
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.