ANJUMAN COLLEGE OF ENGINEERING TECHNOLOGY Department of Computer

  • Slides: 11
Download presentation
ANJUMAN COLLEGE OF ENGINEERING & TECHNOLOGY Department of Computer Science & Engineering Subject: -Design

ANJUMAN COLLEGE OF ENGINEERING & TECHNOLOGY Department of Computer Science & Engineering Subject: -Design & Analysis of Algorithms Prepared By: Prof. Naisha Taban Khan

Syllabus: Ø Unit 1: Mathematical foundations, summation of arithmetic and geometric series, n, n

Syllabus: Ø Unit 1: Mathematical foundations, summation of arithmetic and geometric series, n, n 2 , bounding summations using integration, Recursion and Induction: recurrence relations, solutions of recurrence relations using techniques of characteristic equation, generating functions, master method and substitution method. Complexity calculation of various standard functions, principles of designing algorithms. Ø Unit 2: Asymptotic notations of analysis of algorithms, analyzing control structures, worst case and average case analysis, amortized analysis, application of amortized analysis, Sorting networks, comparison networks, bio-tonic sorting network, advanced data structures like Fibonacci heap, disjoint set representation. Ø Unit 3: Divide and conquer basic strategy, binary search, quick sort, merge sort, matrix operations, Multiplication Algorithm Greedy method – basic strategy, Knapsack Problem, application to job sequencing with deadlines problem, minimum cost spanning trees, single source shortest path, Optimal Search Patterns.

ØUnit 4: Dynamic Programming basic strategy, multistage graphs, all pairs shortest path, single source

ØUnit 4: Dynamic Programming basic strategy, multistage graphs, all pairs shortest path, single source shortest paths, optimal binary search trees, traveling salesman problem, Longest Common Subsequence problem, 0/1 Knapsack Problem, Chained Matrix Multiplication. ØUnit 5: Basic Traversal and Search Techniques, breadth first search and depth first search, connected components. Backtracking basic strategy, 8 Queen’s problem, graph coloring, Hamiltonian cycles etc, Introduction to Approximation algorithm. ØUnit 6: Recursively enumerable (r. e. ) set, recursive sets, Decidability and solvability, Post correspondence Problem (PCP), Introduction to recursive function theory, primitive recursive functions, Ackerman function.

COURSE OUTCOMES: Ø CO 1: Examine the correctness of algorithms using inductive proofs and

COURSE OUTCOMES: Ø CO 1: Examine the correctness of algorithms using inductive proofs and design the solutions to recursive relations. Ø CO 2: Explain Asymptotic Analysis and elaborate the methods of Amortized Analysis. Ø CO 3: Explain different algorithm design techniques like Divide and Conquer & Greedy strategy and make use of algorithms that employ this paradigm. Ø CO 4: Determine the Dynamic Programming paradigm and solve Dynamic Programming algorithms and simplify them. Ø CO 5: Design and illustrate the different traversal techniques and build different graph computations. Ø CO 6: Explain Polynomial and Non polynomial time complexities and elaborate the deterministic and non deterministic algorithms.

Unit-III : Knapsack Problem Ø CO 3: Explain different algorithm design techniques like Divide

Unit-III : Knapsack Problem Ø CO 3: Explain different algorithm design techniques like Divide and Conquer & Greedy strategy and make use of algorithms that employ this paradigm. �The knapsack problem is an optimization problem. �When it is solved using Greedy method, available input will be considered one by one. �Knapsack means a container with maximum capacity W, and a set S consisting of n items given. �Each item i has some weight wi and profit value pi (all wi , pi and W are integer values). �The objective is to store the object in Knapsack either completely or fractionally to achieve maximum profit.

ØApplications of Knapsack Problem: �Memory or Storage management. �Demand Paging. Ø Approches: There are

ØApplications of Knapsack Problem: �Memory or Storage management. �Demand Paging. Ø Approches: There are three approches: 1. Based on Weight: Select the object on the basis that it may use knapsack property as slow as possible (select minimum weight object first). 2. Based on Profit: Select the object depending on the profit at each stage, most profitable remaining object will be selected first. 3. Based on Profit and Weight: Select the object whose profit per unit weight is as high as possible.

Problem 1: Find the optimal solution for Knapsack problem where Capacity = 100 &

Problem 1: Find the optimal solution for Knapsack problem where Capacity = 100 & Number of objects = 5 i/p 1 2 3 4 5 Wi 10 20 30 40 50 Pi 20 30 66 40 60 Pi/Wi 2 1. 5 2. 2 1 1. 2 �Solution:

Ø Based on Weight: i/p Profit Weight Capacity Left 1 20 10 100 -10=90

Ø Based on Weight: i/p Profit Weight Capacity Left 1 20 10 100 -10=90 2 30 20 90 -20=70 3 66 30 70 -30=40 40 40 -40=0 Total Profit 156

Ø Based on Profit: i/p Profit Weight Capacity Left 3 66 30 100 -30=70

Ø Based on Profit: i/p Profit Weight Capacity Left 3 66 30 100 -30=70 5 60 50 70 -50=20 4 40(required weight / Total Weight)=20 30(required weight / Total Weight)=20 20 -20=0 Total Profit 146

Ø Based on Profit & Weight: i/p Profit Weight Capacity Left 3 66 30

Ø Based on Profit & Weight: i/p Profit Weight Capacity Left 3 66 30 100 -30=70 1 20 10 70 -20=50 2 30 20 60 -20=40 5 60(required weight / Total Weight)=48 50(required weight / Total Weight)=40 40 -40=0 Total Profit 164

For this Knapsack Problem 3 rd approach which is based on profit & weight

For this Knapsack Problem 3 rd approach which is based on profit & weight gives maximum profit. Ø Analysis: �Fractional Knapsack has time complexity O(Nlog. N) where N is the number of items in S.