LECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS B. Tech. 6th Semester Computer Science & Engineering and Information Technology Prepared by Mr. S.K. Sathua – Module I Dr. M.R. Kabat – Module II Dr. R. Mohanty – Module III VEER SURENDRA SAI UNIVERSITY OF TECHNOLOGY, BURLA SAMBALPUR, ODISHA, INDIA – 768018
CONTENTS MODULE – I Lecture 1 - Introduction to Design and analysis of algorithms Lecture 2 - Growth of Functions ( Asymptotic notations) Lecture 3 - Recurrences, Solution of Recurrences by substitution Lecture 4 - Recursion tree method Lecture 5 - Master Method Lecture 6 - Worst case analysis of merge sort, quick sort and binary search Lecture 7 - Design and analysis of Divide and Conquer Algorithms Lecture 8 - Heaps and Heap sort Lecture 9 - Priority Queue Lecture 10 - Lower Bounds for Sorting MODULE -II Lecture 11 - Dynamic Programming algorithms Lecture 12 - Matrix Chain Multiplication Lecture 13 - Elements of Dynamic Programming Lecture 14 - Longest Common Subsequence Lecture 15 - Greedy Algorithms Lecture 16 - Activity Selection Problem Lecture 17 - Elements of Greedy Strategy Lecture 18 - Knapsack Problem Lecture 19 - Fractional Knapsack Problem Lecture 20 - Huffman Codes MODULE - III Lecture 21 - Data Structure for Disjoint Sets Lecture 22 - Disjoint Set Operations, Linked list Representation Lecture 23 - Disjoint Forests Lecture 24 - Graph Algorithm - BFS and DFS Lecture 25 - Minimum Spanning Trees Lecture 26 - Kruskal algorithm Lecture 27 - Prim's Algorithm Lecture 28 - Single Source Shortest paths Lecture 29 - Bellmen Ford Algorithm Lecture 30 - Dijkstra's Algorithm MODULE -IV Lecture 31 - Fast Fourier Transform Lecture 32 - String matching Lecture 33 - Rabin-Karp Algorithm Lecture 34 - NP-Completeness Lecture 35 - Polynomial time verification Lecture 36 - Reducibility Lecture 37 - NP-Complete Problems (without proofs) Lecture 38 - Approximation Algorithms Lecture 39 - Traveling Salesman Problem
MODULE - I • Lecture 1 - Introduction to Design and analysis of algorithms • Lecture 2 - Growth of Functions ( Asymptotic notations) • Lecture 3 - Recurrences, Solution of Recurrences by substitution • Lecture 4 - Recursion tree method • Lecture 5 - Master Method • Lecture 6 - Design and analysis of Divide and Conquer Algorithms • Lecture 7 - Worst case analysis of merge sort, quick sort and binary search • Lecture 8 - Heaps and Heap sort • Lecture 9 - Priority Queue • Lecture 10 - Lower Bounds for Sorting
Lecture 1 - Introduction to Design and analysis of algorithms What is an algorithm? Algorithm is a set of steps to complete a task. For example, Task: to make a cup of tea. Algorithm: • add water and milk to the kettle, • boilit, add tea leaves, • Add sugar, and then serve it in cup. What is Computer algorithm? ‘’a set of steps to accomplish or complete a task that is described precisely enough that a computer can run it’’. Described precisely: very difficult for a machine to know how much water, milk to be added etc. in the above tea making algorithm. These algorithmsrun on computers or computational devices.Forexample, GPS in our smartphones, Google hangouts. GPS uses shortest path algorithm. Online shopping uses cryptography which uses RSA algorithm. Characteristics of an algorithm:• Must take an input. • Must give some output(yes/no,valueetc.) • Definiteness –each instruction is clear and unambiguous. • Finiteness –algorithm terminates after a finite number of steps. • Effectiveness –every instruction must be basic i.e. simple instruction.