0% found this document useful (0 votes)
240 views

Data Structures Question Paper

This document describes a data structures exam containing multiple choice and written answer questions. It is divided into three groups: Group A contains questions about algorithms, complexity analysis, and basic data structures. Group B focuses on graphs, hashing, and search trees. Group C only contains multiple choice questions testing fundamental concepts. Students must answer 5 total questions, selecting 2 from Group A, 2 from Group B, and all questions from Group C. Responses should be brief and include diagrams when necessary.

Uploaded by

Swastik Routroy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views

Data Structures Question Paper

This document describes a data structures exam containing multiple choice and written answer questions. It is divided into three groups: Group A contains questions about algorithms, complexity analysis, and basic data structures. Group B focuses on graphs, hashing, and search trees. Group C only contains multiple choice questions testing fundamental concepts. Students must answer 5 total questions, selecting 2 from Group A, 2 from Group B, and all questions from Group C. Responses should be brief and include diagrams when necessary.

Uploaded by

Swastik Routroy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

W'l3:4FN:CP403 (1448)

DATA STRUCTURES
Time : Three hours
Maximum Marks : 100
Answer FIVE questions, taking ANY TWO from Group A,
ANY TWO from Group B and ALL from Group C.
All parts of a question ( a,b,etc.) should
be answered at one place.
Answer should be brief and to-the-point and be supplemented
with neat sketches. Unnecessary long answers may
result in loss of marks.
Any missing or wrong data may be assumed suitably giving
proper justification.
Figures on the right-hand side margin indicate full marks.

Group A
1. (a) Write a CJC++ function to perform linear search on n
data elements for a given key k. What are the worth
case and average case time complexities? 10
(b) Write a recursive c;c++ function to perform binary
search on n data elements for a given key k. What are
the worst case and the best case time complexities ? 10

2. (a) Suppose we store a two dimensional n x n array A in


row major fashion in an one-dimensional B array of size
n 2 • What will be the index of the array elementA[i,j]
in the array B? If we store a two-dimensional n x n array
A in column major fashion in an one-dimensional B
array of size n2 , what will be the index of the array
element A[t,j] in the array B? Explain your answer. 10
(b) Write a c;c++ function to reverse a singly linked list.
You can traverse the list exactly once and can use only (b) Can a binary tree be uniquely re-constructed given its
constant, i.e., 0( 1) additional storage. Briefly explain pre-order and post-order traversals ? Justify your
your answer. 10 answer. 10
3. (a) Write a recursive c;c++ function to count the number 8. (a) Show the result of inserting 2, 1, 4, 5, 9, 3, 6, 7 into an
of nodes in a linked list. 10 initially emptyAVL tree. Specify the type of rotation
after each insertion. 10
(b) Write a c;c++ function to insert a key at an appropriate
place in a sorted linked list. Using this function, write · (b) Delete the element 65 from the following 2-3 tree, i.e.,
B-tree of order 3. 10
the main or the driver function to sort n data
elements. 10 !so I 60 I
4. (a) Write a c;c++ function to insert a key X to the right of
a node pointed by p to~ doubly linked list. 10

(b) Write a c;c++ function to delete a node pointed by p


from a doubly linked list. 10

Group B
5. (a) Write a c;c++ function to delete an element from the Group C
root of a binary search tree. 10 9. Choose the c~rrect answer for the following : 10 X 2
(b) Write a c;c++ function to delete the smallest element (i) The equivalent postfix expression corresponding to
from a binary search tree. 10 the infix expression (A- B)*(D/E) is
(a) ABDEI*-
6. (a) Write a c;c++ function to count the leaves of a binary
(b) AB- D*E/
tree. 10
(c) AB- DE/*
(b) Show the binary search tree that is obtained after (d) ABD*- E/
insertingthekey8, 11,5, 7,9,6, 10, 14, 12. Re-draw
the tree after deleting the root. I0 (ii) Suppose a queue is implemented by a circular array
QUEUE [0 .. 11]. The number of elements in the queue,
7. (a) Construct a binary search tree whose post-order if F~ONT '= 10 and REAR = 3, will be
traversal is as follows: (a) 3
5,4,9, 11, 12, 10,13,6 10 (b) 4
(c) 5
(d) 6
S'13:4FN:CP 403 (1448)

DATA STRUCTURES
Time : Three hours
Maximum Marks : I 00
Answer FIVE questions, taking ANY TWO from Group A,
ANY TWO from Group Band ALL from Group C.

All parts of a question ( a,b,etc.) s!Jould


be answered at one place.
Answer should be brief and to-the-point and be supplemented
with neat sketches. Unnecessary long answers may
result in loss of marks.
Any missing or wrong data may be assumed sui(ably giving
proper justification.
Figures on the right-hand side margin indicate full marks.

Group A
1. (a) What is run time complexity of an algorithm?
Calculate t!Ie run time complexity ofbubble sort. 2 +4
(b) What· is asymptotic little 0 notation (o) ? What is big 0
notation? 2 +2

(c) Design an 0 (n)-time algorithm that, given a real


number x and a sorted arrayS of n numbers,
determine whether or not there exist two elements inS
whose sum is exactly X;

(d) Suppose we have an array of numbers a[l], ... , a[n] in


which the first i numbers a[l], ... , a[i] have been sorted
into ascending order, and the remaining numbers
a[i+ 1], ... , a[ n] have been sorted in descending order.
The aim is to sort the entire array in ascending order.
Design an algorithm which merges the two sorted lists (b) Construct anAVL tree with the following key arriving
into a second array b[l]; ...~ b[n] and copies the in the given order : k, t, v, a, e 6
. .
result back into a. Show that the algorithm takes (c) Insert the following keys into a B-tree of order 3 and
time O(n}. 5 draw the final tree: 10, 24, 23, 11, 31, 16, 26, 35, 29, 20,
46,28,13,27,33,21. 8
2. (a) LetA and B be two linked lists. Write a 'C' function to
create a new linked list C that contains elements Group B
alternately from A and B beginning with the first
element of A. If you run out of elements in one of the 5. (a) Write a 'C' function to compute the degree of a given
lists, then append the remaining.elements of the other vertex of an undirected graph when the graph is
~~c. 6 represented by an adjacency matrix. 6

( b} Let P be a linked list. Write a 'C' function called split to (b) What do you mean by. graph traversal ? Define
create two linked lists Q and R. Q should contain all depth-first traversal (DFS) of a. graph. Write an
elements in odd positions of P and R contains the algorithm of non-recursive d~pth first traversal. 2 + 2 + 4
remaining elements. Your function should not change (c) Compare and contrast between DFS and BFS (Breadth
list P. What is the complexity of your program? 5+3 First Search}. 6
(c) What are the limitations of array data structure ? Show, 6. (a) What is hashing? Giye the characteristics of hash
with the help of an example, how the above limitations function. 2+4
can be avoided by 'linked' lists. What do you mean by
~inear list and generalized list? 2 +2 +2 (b) Name different hash functions with a brief description
and analysis. 8
3. (a) What is a circular iist? Write an aigorithm for
inserting a node at the front. 5 (c) What is collision re-solution technique in hashing?
Explain. 6
(b) Suppose you are given two polynomials. Represent the
polynomial in a suitable data structure and write a 'C' 7. (a) What are the differences between internal sorting and
function to add two polynomials. 6 external sorting ? When is a sorting technique said to
be stable ? Explain with an example. 3+2+2
(c) Writ~ a 'C' program to implement a stack using a
single array. 9 (b) Write a 'C' program of sorting a set of numbers in
descending order using selection sort. Analyse the
4. (a) Define a binary tree. What do you mean by tree algorithm complexity. 4 +2
traversal ? Write one traversal algorithm. 2 + 2 +2
(c) Show the steps of sorting the following sequence in
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
For AMIE Section
B Study Materials
Call 9495951100
www.amieindia.in

JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in


For Coaching
Contact
JYOTHIS ACADEMY
Kottayam
Mob 9495951100
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
AMIE(I) STUDY CIRCLE, SECOND FLOOR, SULTAN TOWER, ROORKEE - 247667 (UTTARANCHAL) EMAIL: [email protected] Ph: (01332) 266328, 9412903929, 9897394020
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
-
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
-
JYOTHIS ACADEMY, Kottayam Mob 9495951100 www.amieindia.in
-
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in
JYOTHIS ACADEMY, KOttayam Mob 9495951100 www.amieindia.in

You might also like