0% found this document useful (0 votes)
233 views18 pages

Endsem Question Paper DSA

The document appears to contain a set of questions related to data structures and algorithms. It includes questions on compressed tries, suffix tries, Huffman coding, AVL tree insertion and deletion, and minimum spanning trees using Prim's and Kruskal's algorithms. For each question, it provides sample inputs and outlines the grading policy for solutions.

Uploaded by

ayush
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)
233 views18 pages

Endsem Question Paper DSA

The document appears to contain a set of questions related to data structures and algorithms. It includes questions on compressed tries, suffix tries, Huffman coding, AVL tree insertion and deletion, and minimum spanning trees using Prim's and Kruskal's algorithms. For each question, it provides sample inputs and outlines the grading policy for solutions.

Uploaded by

ayush
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/ 18

“An Institution of National Importance by an Act of Parliament”

Survey No. 140,141/1, Behind Br. Sheshrao Wankhade Shetkari Sahkari Soot Girni, Village -
Waranga, PO - Bori (Butibori), Nagpur (Rural), Nagpur - 441108
Website: www.iiitn.ac.in Email: [email protected], [email protected] Phone: 0712 – 2985010

Q1: Compressed Tries (Module 3)


Grading policy:
● 2 marks for the standard trie and 3 for the compressed trie.
● If space index ranges are not shown in the compressed trie, then deduce 2 marks.

A. For the given list of words, show a Standard Trie and a Compressed Trie representation (tree
diagram) using space index ranges. (02+03)
● sick
● nick
● picks
● six
● sticks
● mix
● sixers
● nickel
B. For the given list of words, show a Standard Trie and a Compressed Trie representation (tree
diagram) using space index ranges. (02+03)
● must
● trust
● muster
● music
● fusion
● mango
● tussle
● tango
C. For the given list of words, show a Standard Trie and a Compressed Trie representation (tree
diagram) using space index ranges. (02+03)
● more
● sore
● bore
● mosaic
● sorted
● boredom
● assorted
● smore
Q2: Suffix Tries (Module 3)
Grading policy:
● Longest common substring problem must be solved using the same suffix tree.
● If the solution is correct but steps are not shown, deduct 1 mark.
● A
○ Find the longest common substring using Suffix Tries for the following words. Show the
build up of the suffix trie in at least 3-4 steps (3 marks)
■ ATHARVAVEDA, SAMAVEDA, RIGVEDA

○ Find the longest repeating substring using Suffix Trie for the following word. Show the
build up of the suffix trie in at least 3-4 steps (2 marks)
■ MALAYALAM
● B
○ Find the longest common substring using Suffix Tries for the following words. Show the
build up of the suffix trie in at least 3-4 steps (3 marks)
■ KEDARNATH, BADRINATH, AMARNATH
○ Find the longest repeating substring using Suffix Trie for the following word. Show the
build up of the suffix trie in at least 3-4 steps (2 marks)
■ BEEKEEPER
● C
○ Find the longest common substring using Suffix Tries for the following words. Show the
build up of the suffix trie in at least 3-4 steps (3 marks)
■ PAATHSHALA, GAUSHALA, PRAYOGSHALA

○ Find the longest repeating substring using Suffix Trie for the following word. Show the
build up of the suffix trie in at least 3-4 steps (2 marks)
■ MURMURING
Q3: Huffman Coding (Module 3)
Grading policy:
● If the solution is correct but steps are not shown, deduct 1 mark.

● A
○ For the following frequencies of letters, create a huffman tree. Show at least 3-4 steps.
(03 Marks)
■ Q: 4
■ W: 12
■ E: 34
■ R: 45
■ T: 57
■ Y: 69

○ If the left child in the huffman tree is 1 and the right child is 0, then show correct binary
sequences for the following words. (02 marks)
■ QEWRYT
■ YTREWQ
● B
○ For the following frequencies of letters, create a huffman tree. Show at least 3-4 steps.
(03 Marks)
■ A: 3
■ S: 11
■ D: 24
■ F: 31
■ G: 46
■ H: 50
○ If the left child in the huffman tree is 1 and the right child is 0, then show correct binary
sequences for the following words. (02 marks)
■ ADGSFH
■ HGFDSA

● C
○ For the following frequencies of letters, create a huffman tree. Show at least 3-4 steps.
(03 Marks)
■ Z: 9
■ X: 17
■ C: 22
■ V: 32
■ B: 36
■ N: 49

○ If the left child in the huffman tree is 1 and the right child is 0, then show correct binary
sequences for the following words. (02 marks)
■ ZXCVBN
■ ZCBXVN

Update: The code for C is 011 and not 001 (mistake in the image)
Q4 AVL TREE INSERTION
Grading Policy: 0.5 Mark for each insertion. Difference between the largest path length and the shortest
path length may increase in case of increasing the overall height of the tree, for example herein this
example the difference is 1.

● Consider the following AVL tree. Demonstrate the successive insertion of the keys 2, 4, 6, 8, 11,
12, 13, & 14. Show all the intermediate steps clearly. Also, mention the type of imbalance.
Result of the first insertion should be used as input for the second insertion and so on. Also,
comment on the difference between the largest path length and the shortest path length in the
AVL tree.

● Consider the following AVL tree. Demonstrate the successive insertion of the keys 1, 3, 5, 7, 11,
12, 13, & 14. Show all the intermediate steps clearly. Also, mention the type of imbalance.
Result of the first insertion should be used as input for the second insertion and so on. Also,
comment on the difference between the largest path length and the shortest path length in the
AVL tree.

Solution:
Q5 RB TREE DELETION
Grading Policy: 01 mark for each correct deletion. 02 marks for mentioning the type of imbalance,
cases, violation of the RB tree properties, etc.
● Consider the following RB tree. Demonstrate the successive deletion of the keys 7, 11, and 12.
Results after the first deletion should be used as input for the second deletion and so on.

● Consider the following RB tree. Demonstrate the successive deletion of the keys 12, 11, and 7.
Results after the first deletion should be used as input for the second deletion and so on.
Solution:
Q6 GRAPHS
Grading Policy: Tabular step by step Solution of each of these methods: prims (included and non included set of
vertices) 02 marks, Kruskal (set union operation) 02 marks, 01 mark conclusion
● Prims and Kruskal algorithms may produce different spanning trees in case of multiple same
weight edges. Construct the spanning trees using both of these methods on the following
connected graph and verify whether you can generate different spanning trees or not. Mention
each and every step clearly for both of the aforementioned algorithms while constructing the
spanning trees. What conclusions can you draw based on the generated spanning trees?

Solution:
Tabular step by step Solution of each of these methods: prims (included and non included set of vertices), Kruskal
(set union operation)

Conclusion (01 mark)

● Prims and Kruskal algorithms may produce different spanning trees in case of multiple same
weight edges. Construct the spanning trees using both of these methods on the following
connected graph and verify whether you can generate different spanning trees or not. Mention
each and every step clearly for both of the aforementioned algorithms while constructing the
spanning trees. What conclusions can you draw based on the generated spanning trees?
Solution: Tabular step by step Solution of each of these methods: prims (included and non included set of
vertices), Kruskal (set union operation)

Conclusion (01 mark)

You might also like