You are on page 1of 5

Vasavi College of Engineering (Autonomous)

Ibrahimbagh, Hyderabad 500031

DATA STRUCTURES
Assignment - III
Date: 07-11-15
Subject : Data Structures

Faculty : MSV. Sashi Kumar

Year : B.E. 2/4 (Sem-I)

Class

SET
I
II
III
IV
V
VI
VII

: CSE -A

Roll Noss
1602-14-733-001 to 1602-14-733-010
1602-14-733-011 to 1602-14-733-020
1602-14-733-021 to 1602-14-733-030
1602-14-733-031 to 1602-14-733-040
1602-14-733-041 to 1602-14-733-050
1602-14-733-051 to 1602-14-733-060
1602-14-733-301 to 1602-14-733-312, 1602-13-733-307

THE DEADLINE FOR THE SUBMISSION IS DUE ON 17-11-2015


SET - I
1. Given the inorder and post order traversals of a Binary Tree, write a program to check if a Binary
tree can be constructed
2. Given a binary search tree and a value k, find a node in the tree whose value is closest to k
3. Delete the following nodes EAT, DID, RAT, MAT, TAR from the AVL tree built using the following
values
CAT, BAT, RAT, MAT, PAT, HAT, EAT, TEA, TAR, BUT, CUT, TIP, PIT, ATE, DID
4. Calculate all possible minimum cost paths from vertex A to vertex M using Dijkstras Algorithm
for the graph below

5. Explain the working of an algorithm which sorts at least one value after every iteration.

SET - II
1. Given the inorder and pre order traversals of a Binary Tree, write a program to check if a Binary
tree can be constructed
2. Write a program to demonstrate if a given tree is a Binary search tree or not?
3. Explain all the rotations performed while doing insertion and deletion for an AVL tree
4. Write a program which computes all possible cases of traversing a Graph using Depth First
Search, from a chosen vertex, for the given graph

5. Given the following numbers explain the working of a Merge Sort which sorts in descending
order
1 2 3 4 5 6 7 8 9 10
SET - III
1. Given a complete Binary tree of height h, write a program to swap left and right children of any
internal node
2. Write a program to print the inroder traversal of a binary search tree without using recursion
3. Give an example and explain, why does a Binary Search Tree has worst case time complexity of
O(n). Suggest ways to improve the performance.
4. Explain the reason when, for the given graph below, is it always possible to get only one possible
BFS and one possible DFS.

5. Given the following words, sort them in ascending order using Quick Sort
ELECTRONICS, SWITCHING, STRUCTURES, LOGIC, DATA, BASIC, COMPUTER, DISCRETE, SCIENCE,
FUN
SET - IV

1. Given the inorder traversal: 7-8-10-14-15-16-18-19-20 and preorder traversals: 15-7-10-8-142018-16-19 of a Binary search tree, Show the Binary search tree after deleting each of the
following nodes 18, 20, 10 and 15.
2. Write a program to demonstrate deletion of nodes from an AVL Tree
3. Differentiate between the different search trees with respect to the best average and worst
case complexities. Also specify the realtime applications of each of them
4. List the types of graph representation. Compare and illustrate the best ways of implementing
the Graph given below.

5. An application requires interacts with a database which has entries of 200 different attributes,
like Name, age, phone, email, address and so on. There are more than 100000 entries, which
implies the size of the database is atleast 200*100000*(size of each attribute). Which sorting
algorithm can be applied here to sort the entire database. Give reasons

SET - V
1. Construct a Complete Binary tree of height specified by the user such that the inorder traversal
should give a palindrome.
Ex: Height = 3 2 1 3 4 3 1 2,
Height = 4 4 2 5 1 6 3 7 8 7 3 6 1 5 2 4
2. Construct a AVL tree for the following numbers : 20, 19, 18, 1, 2, 3, 16, 15, 17, 6, 4, 5, 8, 14, 9, 13
3. From the below graph, compute all of the possible single source shortest paths using Dijkstras
algorithm

4. Differentiate the working of Prims and Kruskals algorithms, minimum cost spanning tree
algorithms, by giving examples of their applications.
5. Given the following values, demonstrate the working of Min Heapify and Max heapify. Use these
heaps to demonstrate heap sort
14, 13, 2, 11, 8, 7, 4, 15, 13, 1, 10

SET - VI
1. Construct a Binary Search Tree for the following numbers and give the height of the tree
31, 55, 12, 24, 5, 77, 67, 3, 33, 11, 27, 19, 73, 22
2. In the following AVL Tree, demonstrate the rotations involved while performing deletion of the
following nodes: 30, 11, 17, 21, 20, 15

3. How are 2-4 Trees and Red Black trees related? Take atleast 10 numbers and show how a red
black tree can be converted to a 2-4 tree.
4. Calculate the minimum cost shortest path using Dijkstras algorithm from vertex A to vertex F

5. Write a program to implement Heap sort algorithm and explain using an example

SET - VII
1. The post order and inorder traversals of a Binary tree are DCBIFHGEA, CDBAFIEHG. Construct
the resulting Binary Tree by explaining the process, step by step
2. Construct an AVL Tree with the following values: Sun, Mon, Tue, Wed, Thu, Fri, Sat, Jan, Feb,
Mar, Apr, May, Jun, Jul. Show step by step rotations where required and show the Balance
factor of every node

3. Demonstrate the split and merge operations by taking an example in 2-4 tree
4. From the given graph below, show the working of Prims algorithm to find the minimum cost
spanning tree

5. Compare and contrast the Best, Average and Worst case time complexities of all sorting
algorithms learned