overview of algorithm design
DESCRIPTION
ALgorithm DesignTRANSCRIPT
Overview of Algorithm Design
Partha P Chakrabarti
Department of CSE, IIT KharagpurT10KT Main Workshop
May 25, 2015
Developing a ‘Process’ for a Beginner to Learn Algorithm Design
• Problem Specification– Input, Output, Constraints
• Algorithm Features– Termination, Functional Correctness, Efficiency,
User Interface / Interaction, Implementation, Error Handling, Documentation
• An Overall Solution Strategy– Initial Solution, Design Space Exploration and
Analysis, Algorithm Finalization, Data Structuring• Design, Analysis: Algorithm + Data Structure
Problem SpecificationUnambiguously specify the INPUTS, OUTPUTS, CONDITIONS / CONSTRAINTS. Make use of logical operations and mathematical symbols to the extent possible.Additionally give examples to explain the specification given where special cases are properly highlighted)
• Finding the smallest of n integers.• Sorting a set of integers.• Finding the median of a set of numbers.• Finding the number of matches of a pattern in a string.
Modelling Problem Specification• Modelling, Input, Output, Constraints to structures• Use of Real-Life like Examples
– Finding a route in a map– Crypt-arithmetic Problem– Telephone Line Connection Problem– Time Table Scheduling– Stamp Selection Problem– Pumping Water in a City– Travelling Salesperson– Robber’s Dilemma
• Mapping to Models– Combinatorial, Matrices, Graphs, Logic, Constraint Satisfaction /
Optimization Framework, ILP
Basic Steps Towards A Structured Algorithm Design
• Initial Solution• Solution Space Creation • Solution Space Explorations• Analysis of Complexity• Finalization of Options• Data Structuring
Detailing the Process• Initial Solution by Recursive Definition• Analysis by Recurrence Relations• Asymptotic Complexity • Opening up the Recursion Space• Traversal of the Recursion Space• Optimal Choice / Balancing the recursion• Choosing the final solution• Identifying need / sources for memorization• Data Structuring
Demonstration by Examples• Finding the largest of n integers• Largest and Smallest• Largest and second largest• Finding Fibonacci Numbers• Sorting and Searching• (Route Planning) Shortest Path• (Telephone Post Wiring) Spanning Tree (What about the
Telephone Post Placement?)• (Stamp Selection Problem) Sub-Set Sum• (Water Pumping) Max Flow Problem• (Time Table Scheduling) Constraint Satisfaction• Travelling Salesperson
Efficient Algorithms, Hard Problems• Time and Space Complexity
– Asymptotic Complexity– Use Trick Questions
• Adding arbitrarily large numbers• The n = 2*n loop
– Space and Recursion– Output sensitive algorithms (Tower of Hanoi)
• Polynomial Time Algorithms• Polynomial Space Algorithms• Hard Problems
– NP Complete, NP Hard– Exponential Time– Exponential Space
• Approximation• Randomization
Thank You