Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

FISAC : Data Structure and Algorithms (ECE-4070) ,7th Semester

1. Write an algorithm for post order tree traversal of a binary tree using non-recursive method.
Illustrate the algorithm showing stack contents after every iteration for a complete binary
tree with 14 nodes. Write C++ code to implement the above algorithm. Use dynamic
memory allocation for storing binary tree in this implementation. Code should be complete,
along with main function and the post order traversal function. Write comments to your
code. Libraries/built-in functions (Ex: vector) must not be used for implementing any standard data
structures and algorithms that you use in your code.

2. Write a short note on BST and threaded binary tree. Mention time and space complexity
for insertion and deletion of node. For the given tree (yellow box represent the respective
address of the node), write the appropriate graphical representation using linked list for a)
BST b) single treaded tree c) double treaded tree

3. Obtain an AVL tree by inserting one integer at a time in the following sequence. 50, 55,
60, 15, 10, 40, 20, 45, 30, 47, 70, 80. Show all the steps. Write the resultant AVL tree after
deleting the node 45

4. A source generates a message symbols with certain frequencies are given in the table:
Symbols a f l O r t
Frequency 7 8 5 3 9 4
Construct Huffman tree and tabulate the prefix code for each symbol. Encode the message
“floor for rat” using Huffman tree. Also find the efficiency of Huffman coding against the fixed
length coding.

5. Write a C++ program to construct Huffmann code for a given set of characters or message.
Program can read the characters and corresponding frequency as input from the user. The
output of the program must be the Huffman code for each character. Use dynamic memory
allocation wherever applicable. Use MAXHeap to implement Huffmann coding algorithm.
Write comments to the code. Libraries/built-in functions (Ex: vector) must not be used for
implementing any standard data structures and algorithms that you use in your code.
6. For the undirected graph shown, construct the adjacency matrix and adjacency list.

7. Consider the graph shown in following Figure. The Breadth First Search algorithm is
implemented using Queue data structure. The source vertex is “A” and lexicographic
ordering is assumed for the edges emanating from each vertex. Determine the minimum
path form node “A” to “E”. Trace the queue status after every steps and also write the
adjacency list.

8. For the given graph, write the algorithm for


a) Breadth First Search and write the output. Assume source vertex is A
b) Depth First Search and write the output. Assume source vertex is I

9. Explain the algorithm of selection sort with a suitable example. Compare selection sort
with insertion sort
10. Perform radix sort on the array 180, 35, 85, 91, 602, 14, 2, 56. Assume the decimal number
system. Write the C++ code to implement the radix sort for decimal system.

 Submit the “HAND written” assignment on or before 11 Nov 2023.


 Write Name, Reg number, sign on each page with proper margin, staple the pages
and submit. Neatness carries marks.
 All code should be commented. Comments carry marks.

You might also like