0% found this document useful (0 votes)
4 views

Asignment 2

Uploaded by

kingiref
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Asignment 2

Uploaded by

kingiref
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

School of Engineering and Technology

Department of Computer Science and Engineering


Academic Year: 2024-25
BTECH CSE V Sem
Subject Name: Design and Analysis of Algorithms Sub Code: CSE 356
Assignment 2
Date of Submission:15-9-2024 Max Marks:
By the end of the course, students will be able to:

CO 1 Analyze the asymptotic performance of algorithms


Describe the dynamic-programming and Greedy paradigm and explain
CO 2
when analgorithmic design situation calls for it.
CO 3 Demonstrate a familiarity with major algorithms and data structures
CO 4 Apply important algorithmic design paradigms and methods of analysis
CO 5 Discuss NP-complete problems and develop algorithms to solve the problems.
CO 6 Choose appropriate algorithm design techniques for solving problems.
Note: Attempt All Questions.
Q. Questions Marks
No.
Q1. Highlight the 3 major takeaways about greedy algorithms. 6
Q2. Explain the concept of prefix codes with an example. 6
Q3. Find the shortest path using Bellman ford algorithm. 6

Q4. Write Dijkstra's algorithm and apply the same to find single source problem for the 6
following graph taking vertex ‘a’ as source?

Q5. Explain how sum of subsets problem can be solved using the concept of 6
backtracking.
For Slow Learner (Assignment 2 Theory based)
Q6 – Define principle of optimality.
Q7 – What are greedy algorithms? Explain their characteristics?
Q8 – Explain Dijkstra’s algorithm to solve single source shortest path problem with suitable
example.
Q9 – Find optimal solution to the fractional knapsack instances n=7 and knapsack capacity
M=15 where profits and weights are as follows (p1, p2, … p7) = (10, 5, 15, 7, 6, 18, 3) & (w1,
w2, … w7) = (2, 3, 5, 7, 1, 4, 1) respectively.
Q10 Describe Huffman’s algorithm with an example for generation for prefix code.
Q11 What is an optimization problem? How greedy method are can be used to solve the
optimization problem?
Q12 (i) State Bellman ford algorithm using suitable graph find the shortest path.
(ii) Consider following instance for simple knapsack problem. Find the solution using
greedy method.
N = 8 P = {11, 21, 31, 33, 43, 53, 55, 65} W = {1, 11, 21, 23, 33, 43, 45, 55} M = 110
Q13. Given a weighted directed graph G = (V, E) with source s and weight function W: E ->
R, then write an algorithm to solve a single source path problem whose complexity is O(VE).
Apply the same on the following graph.

Q14. Explain and write an algorithm for greedy method of algorithm design. Given 10
activities along with their start and finish time as
S = {A1, A2, A3, A4, A5, A6, A7, A8, A9, A10}
Start time = {1, 2, 3, 4, 7, 8, 9, 9, 11, 12}
Finish time = {3, 5, 4, 7, 10, 9, 11, 13, 12, 14}
Compute a schedule where the largest numbers of activities take place.
For advance Learner (Practical Based)
Q1. Given the array points (balloons are represented as a 2D integer array points where points[i]
= [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and
xend), return the minimum number of arrows that must be shot to burst all balloons.

Q2. You are given an integer array nums. You are initially positioned at the array's first index,
and each element in the array represents your maximum jump length at that position. Return
true if you can reach the last index, or false otherwise.

Q3. Given an array of strings words, return the smallest string that contains each string in words
as a substring. If there are multiple valid strings of the smallest length, return any of them.

Q4. Given two integer arrays gas and cost, return the starting gas station's index if you can
travel around the circuit once in the clockwise direction, otherwise return -1.

Q5. Given a set of n activities with their start and finish times, we need to select the maximum
number of non-conflicting activities that can be performed by a single person, given that the
person can handle only one activity at a time.
Q6. Write a python code to solve the several problems (Coin change, Knapsack, Huffman
coding, and activity selection) using Greedy Approach.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy