You are on page 1of 4

CS 302 – DATA STRUCTURE & ALGORITHMS

Multiple Choice Type Questions

1. i) Maximum possible height of an AVL Tree with 7 nodes is


a) 3 c) 5
b) 4 d) 6

ii) Worst case time complexity of the heap sort algorithm is


2
a) O( Nlog2 N) c) O( n )
3
b) O( Nln N) d) O( n )

om
iii) The prefix notation is also known as

a) Polish notation c) reverse Polish notation


b) reverse Polish notation d) none of these
t.c
iv) Which of the following statements are true in case of Depth-First-Traversal?

i) DFS is used to determine statements are true in case of Depth-First-Traversal?


bu
ii) DFS is used to determine acyclic nature of a graph
a) only (i) is true b) only (ii) is true
b) both (i) and (ii) are true d) all are false
yw

v) Structure in C is an

a) user defined data type


m

b) ADT

c) both (a) and (b)

d) none of these

vi) What is suitable efficient data structure to construct a tree?

a) Linked list
b) Stack
c) Queue
d) none of these
vii) A graph G with n nodes bipartite if it contains

a) n edges
b) a cycle of odd length
c) no cycle of odd length
2
d) n edges

viii) The ratio of items present in the hash table, to the total table size is called

a) balanced factor c) item factor


b) load factor d) none of these

ix) Adjacency matrix of a digraph is


n
a) O ( n ) c) O ( 2 )

om
b) O ( log2 n ) d) O ( nlog2 n )

x) A is an array of size m * n, stored in the row major order. If the address of the first element in
the array is M, the address of the element A (i, j) (A (0, 0) ) is the first element of the array and
each element occupies one location in memory that is
t.c
a) M + (i – j) * m + j – 1 c) M + (j – 1) * m + i -1
bu
b) M + i * m + j d) M + (i -1) * n + j -1

xi) In which collision processing method, it is not required to detect a given list position, if it is
occupied or not?
yw

a) Quadratic c) Rehashing
b) Linked d) None of these
m

xii) The height difference of any node in an AVL tree is

a) -1, 0, 1 c) -2, 0, 2
b) -2, 0, 1 d) -1, 0, 2

Short Answer Type Questions

2. Convert the following into postfix:


a+bхc$d–(e–fхg)/h
3. Write an algorithm for inorder traversal of a threaded binary tree.
4. Is circular queue a non-linear data structure? Justify your answer.
5. What is Hashing? What is Linear Probing?
6. Write an algorithm to delete a node from a doubly linked list, where a node contains one data
and two address (prev & next) portion.
7. Create a AVL tree by inserting the following numbers in the order in which they are given:
17 25 19 23 75
Draw figure for each step.

8. Distinguish between linear and non-linear data structure with suitable example.

Long Answer type Questions

9. a) Represent the following polynomial by linked list (show the diagram only) :
5 3
9x + 3x – 8x + 15
b) Convert the following:
i) A + ( ( ( B – C ) * ( D – E ) + F ) / G ) $ ( H – I ) [POSTFIX]
ii) ABC - / DEF + * + [PREFIX]

om
c) Write an algorithm to add two polynomials.
10. a) What is a graph? Find out the shortest path between all pairs of nodes in the given graph by
Kruskal’s algorithm.
t.c
bu
yw

b) Write down the DFS algorithm.


c) Define a directed graph. Provide an example.
m

11. a) In a 2-tree, if E be the external path length, P be the internal path length and Q be the
number of vertices that are not leaves, then prove that

E = P + 2Q

b) Write a function to delete any node from a binary search tree.

c) The in-order & pre-order traversal sequence of nodes in a binary tree are given below:

In-order: E A C K F H D B G

Pre-order: F A E K C D H G B
12. a) Construct the following Queue of characters where Queue is a circular array which is
allocated six memory cells.
FRONT = 2 REAR = 4 QUEUE: _ , A, C, D, _, _
Describe the Queue as the following operations take place:
i) F is added to the Queue
ii) Two letters are from the Queue
iii) K, L, M are added to the Queue
iv) Two letters are deleted from the Queue
v) R is added to the Queue
vi) One letter is deleted from the Queue

b) What is tail recursion? How is it different from ordinary recursion? What are the difference
between iteration and recursion?

c) Write the push( ) and pop( ) functions for a stack after describing the Data-Structure clearly.

om
13. a) Why is hashing referred as a heuristic search method?
b) Write an algorithm for heap sort algorithm.
t.c
c) Define a B-Tree. Insert the following keys into a B-Tree of order 3. (i.e. the B-tree is a 3-way
tree)
A F B K H M E S R C L
bu
N U P
yw
m

You might also like