SlideShare a Scribd company logo
1
DEPARTMENT OF INFORMATION TECHNOLOGY
Subject Code : CS8451 Subject Name : Design & Analysis ofAlgorithms
Class/ Sem : II IT / II Sem Subject In – Charge : Dr. P. Subathra, Prof./IT
QUESTION BANK
UNIT III
DYNAMIC PROGRAMMING AND GREEDY TECHNIQUE Dynamic programming –
Principle of optimality - Coin changing problem, Computing a Binomial Coefficient – Floyd‘s
algorithm – Multi stage graph - Optimal Binary Search Trees – Knapsack Problem and Memory
functions. GREEDY TECHNIQUE – Container loading problem - Prim‘s algorithm and Kruskal's
Algorithm – 0/1 Knapsack problem, Optimal Merge pattern - Huffman Trees.
Q. No Question
Marks
Knowled
geLevel
Number
of
Times
inAU
PART - A
DYNAMIC PROGRAMMING
1. List out the memory functions used under Dynamic Programming. (R 13
APR/MAY 2015)
2. What do you mean by dynamic programming? (R 13 APR/MAY 2017)
What do you mean by dynamic programming? (R13 APR/MAY2019)
3. what are the differences between dynamic programming and divide and conquer
approaches? (R13 NOV/ DEC 2018)
DYNAMIC PROGRAMMING: PRINCIPLEOF OPTIMALITY
4. State the principle of optimality. (R 17 APR/MAY2019)
DYNAMIC PROGRAMMING: COIN CHANGING PROBLEM
5. Devise an algorithm to make for 1655 using the greedy strategy. The coins
available are {1000, 500, 100, 50, 20, 10, 5}. (R 13 APR/MAY 2017)
DYNAMIC PROGRAMMING: FLOYD‘S ALGORITHM
6. Write down the optimization technique used for Warshall’s algorithm. State the
rules and assumptions which are implied behind that. (R 13 APR/MAY 2015)
2
7. What does Floyd’s algorithm do? (R 13 NOV/ DEC 2017)
8. Define transitive closure of a directed graph. (R13 APR/MAY2018)
DYNAMIC PROGRAMMING: KNAPSACK PROBLEM ANDMEMORYFUNCTIONS
9. How dynamic programming is used to solve Knapsack problem? (R13 NOV/
DEC 2018)
GREEDY TECHNIQUE
10. State the generalprinciple of greedy algorithm. (R 13 APR/MAY 2017)
State the generalprinciple of greedy algorithm(R13 APR/MAY2019)
GREEDYTECHNIQUE : PRIM‘S ALGORITHM ANDKRUSKAL'S ALGORITHM
11.
12. Define the Single Source Shortest Path Problem. (R 13 MAY/JUN 2016)
13. How to calculate the efficiency of Dijkstra’s Algorithm? (R 13 NOV/ DEC 2016)
14. What is Euclidean minimum spanning tree problem? (R 13 MAY/JUN 2016)
15. Define the minimum spanning tree problem. (R13 APR/MAY2018)
Q. No Question
Marks
Knowled
geLevel
Number
of
Times
inAUPART - B
DYNAMIC PROGRAMMING
1. Explain the basic principle of dynamic programming using a simple example. (R
08 NOV/ DEC 2015) (10)
2. Explain the Dynamic Programming with an example. (R 08 NOV/ DEC 2010)
(16)
3. Compare and Contrast greedy algorithm and dynamic programming. (R 08
MAY/JUN 2013)
DYNAMIC PROGRAMMING: Floyd‘s algorithm
3
4. Solve the all pair shortest-path problem for the digraph with the following weight
matrix: (R 13 NOV/ DEC 2016) (16)
5. (Write the Floyd algorithm to find all pair shortest path and derive its time
complexity. (R 17 APR/MAY2019) (4+3)
Solve the following using Floyd's algorithm. (R 17 APR/MAY2019) (6)
6. Explain Floyds-Warshall algorithm using dynamic programming. Trace the
algorithm for the given example. (R13 NOV/ DEC 2018) (13)
DYNAMIC PROGRAMMING: Multi stage graph
7.
8.
DYNAMIC PROGRAMMING: Optimal Binary Search Trees
9. Write an algorithm to construct the optimal binary search tree given the roots
r(i,j), 0<=i<-j<=n. Also prove that this could be performed in time O(n). (R 13
APR/MAY 2015) (8)
DYNAMIC PROGRAMMING: Knapsack Problem and Memory functions
10. Find the optimal solution to the fractional knapsack problem with given data. (R
13 NOV/ DEC 2015) (8)
Item Weight Benefit
A 2 60
B 3 75
C 4 90
4
11. Solve the following instance of the 0/1 knapsack problem given the knapsack
capacity in W=5 using dynamic programming and explain it. (R 13 APR/MAY
2017) (13)
Item Weight Value
1 4 10
2 3 20
3 2 15
4 5 25
12. Find the optimal solution to the fractional knapsack problem wit given data: (R13
APR/MAY2019) (8)
13. Explain the memory function method for the knapsack problem and give the
algorithm. (R13 APR/MAY2018) (13)
14. DYNAMIC PROGRAMMING: TSP
15. Find the optimal tour in the following traveling salesperson problem using
dynamic programming : (R 08 NOV/ DEC 2009) (16)
GREEDY TECHNIQUE
16. Briefly discuss the applications of greedy algorithm. (R 08 NOV/ DEC 2009) (8)
17. Explain the Greedy method in detail with example. (R 08 NOV/ DEC 2015) (10)
GREEDYTECHNIQUE :Prim‘s Algorithm
18. Explain the working of Prim’s Algorithm. (R 13 NOV/ DEC 2017) (13)
19. Discuss about the algorithm and Pseudocode to find the Minimum Spanning Tree
using Prim’s Algorithm. Find the Minimum Spanning tree for the graph shown
below: And discuss the efficiency of the algorithm. (R 13 MAY/JUN 2016)
5
20. Consider the following weighted graph. Given the list of edges in the MST in the
order that Prim’s algorithm inserts them. Start Prim’s algorithm from vertex A. (R
13 NOV/ DEC 2015) (10)
21. Discuss about the algorithm and pseudocode to find the minimum spanning tree
using Prim's algorithm. Find the minimum spanning tree for the graph shown
below: And also discuss the efficiency of the algorithm. (R13 APR/MAY2019)
(13)
22. Give the pseudo code for Prim's algorithm and apply the same to find the
minimum spanning tree of the graph shown below:
GREEDYTECHNIQUE :Kruskal's Algorithm
23. Apply Kruskal’s algorithm to find a minimum spanning tree of the following
graph. (R 13 NOV/ DEC 2016)
24. How do you construct a minimum spanning tree using Kruskal’s algorithm?
Explain. (R 13 APR/MAY 2015) (4)
GREEDYTECHNIQUE :Dijkstra's Algorithm
25. Explain the Dijkstra’s shortest path algorithm and its efficiency. (R 13 NOV/ DEC
2017) (13)
26. Write and analyze the Prim’s Algorithm. (R 13 NOV/ DEC 2015) (6)
6
27. Explain how greedy approach is used in Dijkstra's algorithm for finding the
single-source shortest path for the given graph. (R13 NOV/ DEC 2018) (13)
GREEDYTECHNIQUE :0/1 Knapsack problem
28. Explain how knapsack’s problem is approached using greedy approach to arrive at
a solution. (R 08 APR/ MAY 2011) (10)
GREEDYTECHNIQUE : Huffman Trees.
29. Write the procedure to compute Huffman code. (R 13 NOV/ DEC 2015) (6)
30. Let A= {l/119. m/96, c/247, g/283, h/72, f/77, k/92, j/19} be the letter and its
frequency of distribution in a text file. Compute a suitable Huffman coding to
compress the data effectively. (R 13 APR/MAY 2015) (8)
31. Explain the concept of greedy algorithm with Huffman codes example. (R 08
NOV/ DEC 2010) (8)
32. Write the Huffman’s Algorithm. Construct the Huffman’s tree for the following
data and obtain its Huffman’s Code. (R 13 APR/MAY 2017) (13)
Characte
r
A B C D E -
Probabil
ity
0.
5
0.
35
0.
5
0.
1
0.
4
0.
2
33. The binary string below is the title of a song encoded using Huffman codes. (R 13
NOV/ DEC 2015)
Give the letter frequencies listed in the table below, build the Huffman codes and
use them to decode the title. In cases where there are multiple “greedy” choices,
the codes are assembled by combining the first letter (or group of letters) from left
to right, in the order given in the table. Also, the codes are assigned by labeling
the left and right branches of the prefix/ code tree with ‘0’ and ‘1’ respectively. (R
13 NOV/ DEC 2015) (10)
Let
ter
a h v w
‘
‘
e t l o
Fre
que
ncy
1 1 1 1 2 2 2 3 3
7
34. (b) (i) Write the Huffman code algorithm and derive its time complexity. (R 17
APR/MAY2019) (5+2)
(ii) Generate the Huffman code for the following data comprising of
alphabet and their frequency. a : 1, b : 1, c : 2, d : 3, e: 5,f : 8, g : 13, h :
21 (R 17 APR/MAY2019) (6)
Q. No Question
Marks
Knowled
geLevel
Number
of
Times
inAU
PART - C
DYNAMIC PROGRAMMING
1. The longest common subsequence (LCS) is the problem of finding the longest
subsequence the is present in the given two sequences in the same order but not
necessarily contiguously. write an algorithm using dynamic programming that
determines the LCS of two strings, 'x' and 'y' and returns the string 'z'.
(ii) Prove that any algorithm that searches need to necessarily do Ω(log n)
comparisons.
2. Given a matrix of order MxN, and two coordinates (p,q) and (r,s), which
represents te top-left and bottom-right of a sub-matrix of the matrix, MxN,
calculate the sum of elements present in the submatrix in O(1) time using dynamic
programming. Determine the optimal sub-structure and write an algorithm.
(10)
(ii) Prove that any algorithm that sorts by comparison, requires Ω (n log n)
time. (5)
DYNAMIC PROGRAMMING: Warshal‘s algorithm
8
3. Apply Warshall's algorithm to find the transitive closure of the digraph defined by
the following adjacency matrix.
Prove that the time efficiency of Warshall's algorithm is cubic. (R13 APR/MAY
2018) (7)
Explain why the time efficiency of Warshall's algorithm is inferior to that of the
traversal-based algorithm for sparse graphs represented by their adjacency lists.
(R13 APR/MAY2018) (8)
GREEDYTECHNIQUE :Prim‘s algorithm and Kruskal's Algorithm
4. Apply the greedy technique to fond the minimum spanning tree using Prim's
algorithm for the given graph. (R13 NOV/ DEC 2018) (15)
Staff In – Charge Subject Matter Expert HoD/IT

More Related Content

What's hot

daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Yıldırım Tam
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
Lemia Algmri
 
AES-Advanced Encryption Standard
AES-Advanced Encryption StandardAES-Advanced Encryption Standard
AES-Advanced Encryption Standard
Prince Rachit
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
Amar Jukuntla
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
Abhimanyu Mishra
 
First order logic
First order logicFirst order logic
First order logic
Chinmay Patel
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
Hitesh Wagle
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
Amrinder Arora
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
Mhd Sb
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
Muhammad Muzammal
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
3. mining frequent patterns
3. mining frequent patterns3. mining frequent patterns
3. mining frequent patterns
Azad public school
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
Abhishek Singh
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
Kamal Acharya
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
First order logic
First order logicFirst order logic
First order logic
Megha Sharma
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
Nv Thejaswini
 
Ai notes
Ai notesAi notes
Ai notes
AbdullahGubbi1
 

What's hot (20)

daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
 
AES-Advanced Encryption Standard
AES-Advanced Encryption StandardAES-Advanced Encryption Standard
AES-Advanced Encryption Standard
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
First order logic
First order logicFirst order logic
First order logic
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
 
3. mining frequent patterns
3. mining frequent patterns3. mining frequent patterns
3. mining frequent patterns
 
0 1 knapsack using branch and bound
0 1 knapsack using branch and bound0 1 knapsack using branch and bound
0 1 knapsack using branch and bound
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
 
First order logic
First order logicFirst order logic
First order logic
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 
Ai notes
Ai notesAi notes
Ai notes
 

Similar to 3. cs8451 daa anna univ question bank unit 3

2. cs8451 daa anna univ question bank unit 2
2. cs8451 daa anna univ question bank unit 22. cs8451 daa anna univ question bank unit 2
5. cs8451 daa anna univ question bank unit 5
5. cs8451 daa anna univ question bank unit 55. cs8451 daa anna univ question bank unit 5
4. cs8451 daa anna univ question bank unit 4
4. cs8451 daa anna univ question bank unit 44. cs8451 daa anna univ question bank unit 4
Anna University Question Bank Unit I
Anna University Question Bank Unit IAnna University Question Bank Unit I
Anna University Question Bank Unit I
Anna University Question Bank Unit IAnna University Question Bank Unit I
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questioCS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
Karthik Venkatachalam
 
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
BGS Institute of Technology, Adichunchanagiri University (ACU)
 
Large scale logistic regression and linear support vector machines using spark
Large scale logistic regression and linear support vector machines using sparkLarge scale logistic regression and linear support vector machines using spark
Large scale logistic regression and linear support vector machines using spark
Mila, Université de Montréal
 
R and Visualization: A match made in Heaven
R and Visualization: A match made in HeavenR and Visualization: A match made in Heaven
R and Visualization: A match made in Heaven
Edureka!
 
KMAP PAPER (1)
KMAP PAPER (1)KMAP PAPER (1)
KMAP PAPER (1)
Aleksey Levkovskyi
 
Analysis of Impact of Graph Theory in Computer Application
Analysis of Impact of Graph Theory in Computer ApplicationAnalysis of Impact of Graph Theory in Computer Application
Analysis of Impact of Graph Theory in Computer Application
IRJET Journal
 
Vehicular Ad-hoc network (VANET)
Vehicular Ad-hoc network (VANET)Vehicular Ad-hoc network (VANET)
Vehicular Ad-hoc network (VANET)
Limon Prince
 
Slide1
Slide1Slide1
Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012
Jussara F.M.
 
CS 542 -- Query Execution
CS 542 -- Query ExecutionCS 542 -- Query Execution
CS 542 -- Query Execution
J Singh
 
2nd Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
2nd  Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...2nd  Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
2nd Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
BGS Institute of Technology, Adichunchanagiri University (ACU)
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
 
Prim algorithm for the implementation of random mazes in videogames
Prim algorithm for the  implementation of random mazes  in videogamesPrim algorithm for the  implementation of random mazes  in videogames
Prim algorithm for the implementation of random mazes in videogames
Félix Santos
 
Lesson 6 recursion
Lesson 6  recursionLesson 6  recursion
Lesson 6 recursion
MLG College of Learning, Inc
 
A1802040111
A1802040111A1802040111
A1802040111
IOSR Journals
 

Similar to 3. cs8451 daa anna univ question bank unit 3 (20)

2. cs8451 daa anna univ question bank unit 2
2. cs8451 daa anna univ question bank unit 22. cs8451 daa anna univ question bank unit 2
2. cs8451 daa anna univ question bank unit 2
 
5. cs8451 daa anna univ question bank unit 5
5. cs8451 daa anna univ question bank unit 55. cs8451 daa anna univ question bank unit 5
5. cs8451 daa anna univ question bank unit 5
 
4. cs8451 daa anna univ question bank unit 4
4. cs8451 daa anna univ question bank unit 44. cs8451 daa anna univ question bank unit 4
4. cs8451 daa anna univ question bank unit 4
 
Anna University Question Bank Unit I
Anna University Question Bank Unit IAnna University Question Bank Unit I
Anna University Question Bank Unit I
 
Anna University Question Bank Unit I
Anna University Question Bank Unit IAnna University Question Bank Unit I
Anna University Question Bank Unit I
 
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questioCS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
 
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
 
Large scale logistic regression and linear support vector machines using spark
Large scale logistic regression and linear support vector machines using sparkLarge scale logistic regression and linear support vector machines using spark
Large scale logistic regression and linear support vector machines using spark
 
R and Visualization: A match made in Heaven
R and Visualization: A match made in HeavenR and Visualization: A match made in Heaven
R and Visualization: A match made in Heaven
 
KMAP PAPER (1)
KMAP PAPER (1)KMAP PAPER (1)
KMAP PAPER (1)
 
Analysis of Impact of Graph Theory in Computer Application
Analysis of Impact of Graph Theory in Computer ApplicationAnalysis of Impact of Graph Theory in Computer Application
Analysis of Impact of Graph Theory in Computer Application
 
Vehicular Ad-hoc network (VANET)
Vehicular Ad-hoc network (VANET)Vehicular Ad-hoc network (VANET)
Vehicular Ad-hoc network (VANET)
 
Slide1
Slide1Slide1
Slide1
 
Rapport_Cemracs2012
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012
 
CS 542 -- Query Execution
CS 542 -- Query ExecutionCS 542 -- Query Execution
CS 542 -- Query Execution
 
2nd Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
2nd  Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...2nd  Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
2nd Semester M Tech: Computer Science and Engineering (Jun-2016) Question Pa...
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
 
Prim algorithm for the implementation of random mazes in videogames
Prim algorithm for the  implementation of random mazes  in videogamesPrim algorithm for the  implementation of random mazes  in videogames
Prim algorithm for the implementation of random mazes in videogames
 
Lesson 6 recursion
Lesson 6  recursionLesson 6  recursion
Lesson 6 recursion
 
A1802040111
A1802040111A1802040111
A1802040111
 

More from P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai

TestFile
TestFileTestFile
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
1. 6 doubly linked list
1. 6 doubly linked list1. 6 doubly linked list
1. 5 Circular singly linked list
1. 5 Circular singly linked list1. 5 Circular singly linked list
1. 4 Singly linked list deletion
1. 4 Singly linked list deletion1. 4 Singly linked list deletion
1. 3 singly linked list insertion 2
1. 3 singly linked list   insertion 21. 3 singly linked list   insertion 2
1. 2 Singly Linked List
1. 2 Singly Linked List1. 2 Singly Linked List
1. C Basics for Data Structures Bridge Course
1. C Basics for Data Structures   Bridge Course1. C Basics for Data Structures   Bridge Course
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
The stable marriage problem iterative improvement method
The stable marriage problem iterative improvement methodThe stable marriage problem iterative improvement method
The stable marriage problem iterative improvement method
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Maximum matching in bipartite graphs iterative improvement method
Maximum matching in bipartite graphs   iterative improvement methodMaximum matching in bipartite graphs   iterative improvement method
Maximum matching in bipartite graphs iterative improvement method
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Knapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom upKnapsack dynamic programming formula bottom up
Huffman tree coding greedy approach
Huffman tree coding  greedy approachHuffman tree coding  greedy approach
Simplex method
Simplex methodSimplex method
Simplex method
Simplex methodSimplex method
Multiplication of integers &amp; strassens matrix multiplication subi notes
Multiplication of integers &amp; strassens matrix multiplication   subi notesMultiplication of integers &amp; strassens matrix multiplication   subi notes
Multiplication of integers &amp; strassens matrix multiplication subi notes
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 

More from P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai (20)

TestFile
TestFileTestFile
TestFile
 
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
 
1. 6 doubly linked list
1. 6 doubly linked list1. 6 doubly linked list
1. 6 doubly linked list
 
1. 5 Circular singly linked list
1. 5 Circular singly linked list1. 5 Circular singly linked list
1. 5 Circular singly linked list
 
1. 4 Singly linked list deletion
1. 4 Singly linked list deletion1. 4 Singly linked list deletion
1. 4 Singly linked list deletion
 
1. 3 singly linked list insertion 2
1. 3 singly linked list   insertion 21. 3 singly linked list   insertion 2
1. 3 singly linked list insertion 2
 
1. 2 Singly Linked List
1. 2 Singly Linked List1. 2 Singly Linked List
1. 2 Singly Linked List
 
1. C Basics for Data Structures Bridge Course
1. C Basics for Data Structures   Bridge Course1. C Basics for Data Structures   Bridge Course
1. C Basics for Data Structures Bridge Course
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Approximation Algorithms TSP
 
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
Optimal binary search tree dynamic programming
 
The stable marriage problem iterative improvement method
The stable marriage problem iterative improvement methodThe stable marriage problem iterative improvement method
The stable marriage problem iterative improvement method
 
Maximum matching in bipartite graphs iterative improvement method
Maximum matching in bipartite graphs   iterative improvement methodMaximum matching in bipartite graphs   iterative improvement method
Maximum matching in bipartite graphs iterative improvement method
 
Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)
 
Knapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom upKnapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom up
 
Huffman tree coding greedy approach
Huffman tree coding  greedy approachHuffman tree coding  greedy approach
Huffman tree coding greedy approach
 
Simplex method
Simplex methodSimplex method
Simplex method
 
Simplex method
Simplex methodSimplex method
Simplex method
 
Multiplication of integers &amp; strassens matrix multiplication subi notes
Multiplication of integers &amp; strassens matrix multiplication   subi notesMultiplication of integers &amp; strassens matrix multiplication   subi notes
Multiplication of integers &amp; strassens matrix multiplication subi notes
 

Recently uploaded

Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 

Recently uploaded (20)

Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 

3. cs8451 daa anna univ question bank unit 3

  • 1. 1 DEPARTMENT OF INFORMATION TECHNOLOGY Subject Code : CS8451 Subject Name : Design & Analysis ofAlgorithms Class/ Sem : II IT / II Sem Subject In – Charge : Dr. P. Subathra, Prof./IT QUESTION BANK UNIT III DYNAMIC PROGRAMMING AND GREEDY TECHNIQUE Dynamic programming – Principle of optimality - Coin changing problem, Computing a Binomial Coefficient – Floyd‘s algorithm – Multi stage graph - Optimal Binary Search Trees – Knapsack Problem and Memory functions. GREEDY TECHNIQUE – Container loading problem - Prim‘s algorithm and Kruskal's Algorithm – 0/1 Knapsack problem, Optimal Merge pattern - Huffman Trees. Q. No Question Marks Knowled geLevel Number of Times inAU PART - A DYNAMIC PROGRAMMING 1. List out the memory functions used under Dynamic Programming. (R 13 APR/MAY 2015) 2. What do you mean by dynamic programming? (R 13 APR/MAY 2017) What do you mean by dynamic programming? (R13 APR/MAY2019) 3. what are the differences between dynamic programming and divide and conquer approaches? (R13 NOV/ DEC 2018) DYNAMIC PROGRAMMING: PRINCIPLEOF OPTIMALITY 4. State the principle of optimality. (R 17 APR/MAY2019) DYNAMIC PROGRAMMING: COIN CHANGING PROBLEM 5. Devise an algorithm to make for 1655 using the greedy strategy. The coins available are {1000, 500, 100, 50, 20, 10, 5}. (R 13 APR/MAY 2017) DYNAMIC PROGRAMMING: FLOYD‘S ALGORITHM 6. Write down the optimization technique used for Warshall’s algorithm. State the rules and assumptions which are implied behind that. (R 13 APR/MAY 2015)
  • 2. 2 7. What does Floyd’s algorithm do? (R 13 NOV/ DEC 2017) 8. Define transitive closure of a directed graph. (R13 APR/MAY2018) DYNAMIC PROGRAMMING: KNAPSACK PROBLEM ANDMEMORYFUNCTIONS 9. How dynamic programming is used to solve Knapsack problem? (R13 NOV/ DEC 2018) GREEDY TECHNIQUE 10. State the generalprinciple of greedy algorithm. (R 13 APR/MAY 2017) State the generalprinciple of greedy algorithm(R13 APR/MAY2019) GREEDYTECHNIQUE : PRIM‘S ALGORITHM ANDKRUSKAL'S ALGORITHM 11. 12. Define the Single Source Shortest Path Problem. (R 13 MAY/JUN 2016) 13. How to calculate the efficiency of Dijkstra’s Algorithm? (R 13 NOV/ DEC 2016) 14. What is Euclidean minimum spanning tree problem? (R 13 MAY/JUN 2016) 15. Define the minimum spanning tree problem. (R13 APR/MAY2018) Q. No Question Marks Knowled geLevel Number of Times inAUPART - B DYNAMIC PROGRAMMING 1. Explain the basic principle of dynamic programming using a simple example. (R 08 NOV/ DEC 2015) (10) 2. Explain the Dynamic Programming with an example. (R 08 NOV/ DEC 2010) (16) 3. Compare and Contrast greedy algorithm and dynamic programming. (R 08 MAY/JUN 2013) DYNAMIC PROGRAMMING: Floyd‘s algorithm
  • 3. 3 4. Solve the all pair shortest-path problem for the digraph with the following weight matrix: (R 13 NOV/ DEC 2016) (16) 5. (Write the Floyd algorithm to find all pair shortest path and derive its time complexity. (R 17 APR/MAY2019) (4+3) Solve the following using Floyd's algorithm. (R 17 APR/MAY2019) (6) 6. Explain Floyds-Warshall algorithm using dynamic programming. Trace the algorithm for the given example. (R13 NOV/ DEC 2018) (13) DYNAMIC PROGRAMMING: Multi stage graph 7. 8. DYNAMIC PROGRAMMING: Optimal Binary Search Trees 9. Write an algorithm to construct the optimal binary search tree given the roots r(i,j), 0<=i<-j<=n. Also prove that this could be performed in time O(n). (R 13 APR/MAY 2015) (8) DYNAMIC PROGRAMMING: Knapsack Problem and Memory functions 10. Find the optimal solution to the fractional knapsack problem with given data. (R 13 NOV/ DEC 2015) (8) Item Weight Benefit A 2 60 B 3 75 C 4 90
  • 4. 4 11. Solve the following instance of the 0/1 knapsack problem given the knapsack capacity in W=5 using dynamic programming and explain it. (R 13 APR/MAY 2017) (13) Item Weight Value 1 4 10 2 3 20 3 2 15 4 5 25 12. Find the optimal solution to the fractional knapsack problem wit given data: (R13 APR/MAY2019) (8) 13. Explain the memory function method for the knapsack problem and give the algorithm. (R13 APR/MAY2018) (13) 14. DYNAMIC PROGRAMMING: TSP 15. Find the optimal tour in the following traveling salesperson problem using dynamic programming : (R 08 NOV/ DEC 2009) (16) GREEDY TECHNIQUE 16. Briefly discuss the applications of greedy algorithm. (R 08 NOV/ DEC 2009) (8) 17. Explain the Greedy method in detail with example. (R 08 NOV/ DEC 2015) (10) GREEDYTECHNIQUE :Prim‘s Algorithm 18. Explain the working of Prim’s Algorithm. (R 13 NOV/ DEC 2017) (13) 19. Discuss about the algorithm and Pseudocode to find the Minimum Spanning Tree using Prim’s Algorithm. Find the Minimum Spanning tree for the graph shown below: And discuss the efficiency of the algorithm. (R 13 MAY/JUN 2016)
  • 5. 5 20. Consider the following weighted graph. Given the list of edges in the MST in the order that Prim’s algorithm inserts them. Start Prim’s algorithm from vertex A. (R 13 NOV/ DEC 2015) (10) 21. Discuss about the algorithm and pseudocode to find the minimum spanning tree using Prim's algorithm. Find the minimum spanning tree for the graph shown below: And also discuss the efficiency of the algorithm. (R13 APR/MAY2019) (13) 22. Give the pseudo code for Prim's algorithm and apply the same to find the minimum spanning tree of the graph shown below: GREEDYTECHNIQUE :Kruskal's Algorithm 23. Apply Kruskal’s algorithm to find a minimum spanning tree of the following graph. (R 13 NOV/ DEC 2016) 24. How do you construct a minimum spanning tree using Kruskal’s algorithm? Explain. (R 13 APR/MAY 2015) (4) GREEDYTECHNIQUE :Dijkstra's Algorithm 25. Explain the Dijkstra’s shortest path algorithm and its efficiency. (R 13 NOV/ DEC 2017) (13) 26. Write and analyze the Prim’s Algorithm. (R 13 NOV/ DEC 2015) (6)
  • 6. 6 27. Explain how greedy approach is used in Dijkstra's algorithm for finding the single-source shortest path for the given graph. (R13 NOV/ DEC 2018) (13) GREEDYTECHNIQUE :0/1 Knapsack problem 28. Explain how knapsack’s problem is approached using greedy approach to arrive at a solution. (R 08 APR/ MAY 2011) (10) GREEDYTECHNIQUE : Huffman Trees. 29. Write the procedure to compute Huffman code. (R 13 NOV/ DEC 2015) (6) 30. Let A= {l/119. m/96, c/247, g/283, h/72, f/77, k/92, j/19} be the letter and its frequency of distribution in a text file. Compute a suitable Huffman coding to compress the data effectively. (R 13 APR/MAY 2015) (8) 31. Explain the concept of greedy algorithm with Huffman codes example. (R 08 NOV/ DEC 2010) (8) 32. Write the Huffman’s Algorithm. Construct the Huffman’s tree for the following data and obtain its Huffman’s Code. (R 13 APR/MAY 2017) (13) Characte r A B C D E - Probabil ity 0. 5 0. 35 0. 5 0. 1 0. 4 0. 2 33. The binary string below is the title of a song encoded using Huffman codes. (R 13 NOV/ DEC 2015) Give the letter frequencies listed in the table below, build the Huffman codes and use them to decode the title. In cases where there are multiple “greedy” choices, the codes are assembled by combining the first letter (or group of letters) from left to right, in the order given in the table. Also, the codes are assigned by labeling the left and right branches of the prefix/ code tree with ‘0’ and ‘1’ respectively. (R 13 NOV/ DEC 2015) (10) Let ter a h v w ‘ ‘ e t l o Fre que ncy 1 1 1 1 2 2 2 3 3
  • 7. 7 34. (b) (i) Write the Huffman code algorithm and derive its time complexity. (R 17 APR/MAY2019) (5+2) (ii) Generate the Huffman code for the following data comprising of alphabet and their frequency. a : 1, b : 1, c : 2, d : 3, e: 5,f : 8, g : 13, h : 21 (R 17 APR/MAY2019) (6) Q. No Question Marks Knowled geLevel Number of Times inAU PART - C DYNAMIC PROGRAMMING 1. The longest common subsequence (LCS) is the problem of finding the longest subsequence the is present in the given two sequences in the same order but not necessarily contiguously. write an algorithm using dynamic programming that determines the LCS of two strings, 'x' and 'y' and returns the string 'z'. (ii) Prove that any algorithm that searches need to necessarily do Ω(log n) comparisons. 2. Given a matrix of order MxN, and two coordinates (p,q) and (r,s), which represents te top-left and bottom-right of a sub-matrix of the matrix, MxN, calculate the sum of elements present in the submatrix in O(1) time using dynamic programming. Determine the optimal sub-structure and write an algorithm. (10) (ii) Prove that any algorithm that sorts by comparison, requires Ω (n log n) time. (5) DYNAMIC PROGRAMMING: Warshal‘s algorithm
  • 8. 8 3. Apply Warshall's algorithm to find the transitive closure of the digraph defined by the following adjacency matrix. Prove that the time efficiency of Warshall's algorithm is cubic. (R13 APR/MAY 2018) (7) Explain why the time efficiency of Warshall's algorithm is inferior to that of the traversal-based algorithm for sparse graphs represented by their adjacency lists. (R13 APR/MAY2018) (8) GREEDYTECHNIQUE :Prim‘s algorithm and Kruskal's Algorithm 4. Apply the greedy technique to fond the minimum spanning tree using Prim's algorithm for the given graph. (R13 NOV/ DEC 2018) (15) Staff In – Charge Subject Matter Expert HoD/IT