DS Question Papers (2009 To 2023)

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

Seat No.: _____ Enrolment No.

______

GUJARAT TECHNOLOGICAL UNIVERSITY


B.E. Sem-III Examination December 2009

Subject code: 130702 Subject ame: Data & File Structure.


Date: 19 /12 / 2009 Time: 11.00 am – 1.30 pm
Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Define data structure. List the various linear and non-linear data 05
structures and explain them in brief.
(b) Discuss the basic operations performed with linear structure. 05
(c) What is recursion? Write a C program for GCD using recursion. 04
Q.2 (a) Write an algorithm to convert infix expression to postfix expression. 05
(b) Write an algorithm for evaluation of postfix expression and evaluation 07
the following expression showing every status of stack in tabular form.

(i) 546+*493/+* (ii) 752+*411+/-


OR
(b) Trace the conversion of infix to postfix form in tabular form. 07

(i) (A+B*C/D-E+F/G/(H+I))
(ii) ( A + B ) * C + D / ( B + A * C ) + D
(c) Explain Difference between Stack and Queue. 02

Q.3 (a) Explain following: 06


(i) DQUEUE (ii) Priority Queue
(iii) Circular Queue.
(b) Write the implementation procedure of basic primitive operations of 05
the stack using:
(i) Linear array (ii) linked list.
(c) Consider the following arithmetic expression P, written in postfix 03
notation. Translate it in infix notation and evaluate.
P: 12, 7, 3, -, /, 2, 1, 5, +, *, +
OR
Q.3 (a) What is Hashing? Explain various Hashing Functions. 05
(b) Write the implementation procedure of basic primitive operations of 05
the Queue using:
(i) Linear array (ii) linked list.
(c) Discuss advantages and disadvantages of linked list over array. 04

Q.4 (a) Explain Sequential Files and Indexed Sequential Files Structures. 08
(b) Explain the Preorder, Inorder and Postorder traversal techniques of the 06
binary tree with suitable example.
OR
Q.4 (a) Explain the terms: File, Field, Record, Database, Key. 06

1
(b) Which are the basic traversing techniques of the Graph? Write the 08
algorithm of any one of them.

Q.5 (a) Construct the AVL search tree by inserting the following elements in 06
the order of their occurrence.
64, 1, 44, 26, 13, 110, 98, 85
(b) Discuss following with reference to graphs. 08
(i) Directed graph (ii) Undirected graph (iii) Degree of vertex
(iv)Null graph
OR
Q.5 (a) Explain matrix and linked list representation of a graph 06
(b) Discuss following with reference to trees. 08

(i) Height of the tree (ii) Binary tree (iii)Strictly binary tree
(iv) Sibling
***********

2
Seat No.: _____ Enrolment No.______

GUJARAT TECHNOLOGICAL UNIVERSITY


B.E. Sem-III Remedial Examination March 2010

Subject code: 130702


Subject ame: Data and file structure
Date: 10 / 03 / 2010 Time: 11.00 am – 01.30 pm
Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q1 A Write an algorithm for push, pop and empty operations on stack. Using above 07
functions write an algorithm to determine if an input character string is of the
form
aibi where i>=1 i.e. no of a should be equal to no of b

B Transform the following expression to postfix(reverse polish)and evaluate 03


postfix expression by assuming A=1,B=2,C=3,D=4,E=6,F=6,G=1,I=3 and
J=3

A +B-C*D/E +F$G/(I+J)

C What are the advantages and disadvantages of stack and queue implemented 04
using linked list over array?
Q2 A Write an algorithm to perform each of the following operations on Circular 07
singly linked list using header node
1. add node at the end
2. add node at beginning
3. delete a node which contain element x
4. insert a node containing x after node having address p

B Write an algorithm to implement ascending priority queue using singular 07


linear linked list which has insert() function such that queue remains ordered
list. Also implement remove() function
OR
B Write a c/c++ program to add two polynomials represented using doubly 07
linear linked list. Also write necessary functions to represent polynomial
using doubly linear link list.
Q3 A Define following terms related to tree with example 04
(1) Binary tree
(2) Binary search tree
(3) Strictly binary tree
(4) Complete binary tree

1
B Construct a tree for the given inorder and postorder traversals 05
Inorder DGBAHEICF
Postorder GDBHIEFCA

C Why is Threaded binary tree required? Draw a right in threaded binary tree 05
for the given tree in Fig. 1
OR
Q3 A Construct binary search tree for the following data 07
10,3,15,22,6,45,65,23,78,34,5
Find its inorder, preorder and postorder travesal

B Define height of the binary tree. Define height balanced tree with its 07
advantages. Construct a height balanced binary tree (AVL tree) for the
following data
42,06,54,62,88,50,22,32,12,33
Q4 A Consider the graph shown in Fig 2. Find depth-first and breadth first 07
traversals of this graph starting at A
B Define spanning tree and minimum spanning tree. Find the minimum 07
spanning tree of the graph shown in Fig 3.
OR
Q4 A Give example and applications of directed and undirected graphs. Find the 07
adjacency matrix for the graph shown in Fig 4.
B Apply Dijkstra’s algorithm to find shortest path between vertex A and vertex 07
F5 for the graph shown in Fig 5.
Q5 A What are the advantages of Multiway search tree in disc access? 07
Construct B tree of order 5 for the following data
1,7,6,2,11,5,10,13,12,20,16,24,3,4,18,19,14,25
B What are the advantages of Hashing? Discuss problem of collision in 07
Hashing. Also discuss collision resolution techniques.
OR
Q5 A The integers given below are to be inserted in a hash table with 5 locations 07
using chaining to resolve collisions. Construct hash table and use simplest
hash function.
1,2,3,4,5,10,21,22,33,34,15,32,31,48,49,50
B Define following terms 07
(1) Time and space complexity of an algorithm
(2) Sparse matrix
(3) Sequential , direct and Index sequential access of files

*****

2
A A

B E C
H B

C D F D E
F
G Fig 2
Fig 1

A 2
B D 6
5 1
4 4 7 F
A
1
3 E 2
6 3
B C E
6
5 7 5
2
D Fig 5
1
C

Fig 3

6
3
2

5
4

Fig 4

3
GUJARAT TECHNOLOGICAL UNIVERSITY
B.E. Sem-III Regular / Remedial Examination December 2010

Subject code: 130702


Subject Name: Data and File Structure
Date: 14 /12 /2010 Time: 10.30 am – 01.00 pm
Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 14
(a) What is sparse matrix? Explain
(b) What does abstract data type means?
(c) What is the difference between linear and nonlinear data structure.
(d) Consider the following queue, where queue is a circular queue having 6
memory cells. Front=2, Rear=4
Queue: _, A, C, D, _, _
Describe queue as following operation take place:
F is added to the queue
Two letters are deleted
R is added to the queue
S is added to the queue
One letter is deleted
(e) Give definition of a) Complete binary tree b) Height of tree
(f) Give difference between recursion and iteration
(g) What is 2-3 tree?

Q.2 (a) Translate the following string into Polish notation and trace the content of 07
stack (a + b ^ c ^ d) * ( e + f / d )
(b) Write an algorithm which will check that the given string belongs to following 05
grammar or not
L={wcwR | w Є {a,b}*}(Where wR is the reverse of w)
(c) Convert the following string into prefix : 02
A-B/(C*D^E)
OR
(b) Write a function to implement insertion of an element in circular queue using 05
link list.
(c) Write an algorithm to change the i th value of stack to value X 02

Q.3 (a) Write a short note on threaded binary tree 04


(b) Write an algorithm to insert an element into a singly link list 04
(c) Write an algorithm to delete an element from a doubly link list 04
(d) What is circular link list? 02

OR
Q.3 (a) What is the meaning of height balanced tree? How rebalancing is done in 04
height balanced tree.
(b) Write a short note on doubly link list 04
(c) Write an advantage of link list , doubly link list and circular link list 04
(d) Explain priority queue 02
1
Q.4 (a) Create a binary search tree for the following data : 06
50 ,25 ,75, 22,40,60,80,90,15,30
(b) What is graph? How it can be represented using adjacency matrix, what is path 06
matrix? How path matrix can be found out using adjacency matrix .
(c) What is spanning tree ? 02
OR
Q.4 (a) Give traversal order of following tree into inorder, preorder and postorder. 06

(b) Explain BFS and DFS with example 06


(c) Write warshall algorithm for graph. 02

Q.5 (a) Explain various multiple key access file organization in brief with advantages 07
and disadvantages of each method.
(b) Explain hashing for direct files. 07
OR
Q.5 (a) What do you mean by hashing? What are various hash function. Explain each 07
one in brief.
(b) List various fundamental file organization techniques and explain each in 07
brief.

*************

2
Seat No.: _____ Enrolment No.______

GUJARAT TECHNOLOGICAL UNIVERSITY


B.E. Sem-III Remedial Examination May 2011

Subject code: 130702 Subject Name: Data and File Structure


Date: 25-05-2011 Time: 10.30 am – 01.00 pm
Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Define Algorithm. Write an algorithm to multiply two matrices. Also 07
Perform Time Analysis for the same.
(b) 1.Differentiate the following terms: [04] 07
a. Liner and Non-Linear Data Structures
b. Primitive and Non-Primitive Data Structures
2. Explain Recursion with the help of an Example. [03]
Q.2 (a) 1. Write down algorithms for performing push and pop 07
operations on a stack. [04]
2. Write an algorithm to convert parenthesized infix expression to
postfix. [03]
(b) Write a Program to perform insert and delete operations on a circular 07
Queue.
OR
(b) 1. Compare the efficiencies of BFS and DFS. [03] 07
2. Give the DFS and BFS spanning tree for the graph given below.
[04]

Q.3 (a) 1. Write a function in any programming language to insert an 07


element in an ordered list. [03]
2. Write a program to count number of nodes in a linked list.
[04]
(b) Write a Program to perform all (create, insert, delete, display) the 07
operations in a circular linked list.
OR
Q.3 (a) 1. Write an algorithm to delete an element from a singly linked 07
list. [03]
2. State the advantages of circular and doubly linked lists over a
singly linked list. [04]
(b) Write a Program to perform all (create, insert, delete, display) the 07
operations in a doubly linked list.

1
Q.4 (a) 1. Define the following: [03] 07
1. Complete Binary Tree
2. Almost Complete Binary Tree
2. Answer the following for the below given Graph. [04]

1. What is the outdegree of node B.


2. Write down a path from node D to node A.
3. Is the above graph a multigraph? Give a reason for your answer.
4. What is the total degree of node A.
(b) Write an algorithm to delete a node from a binary tree. 07
OR
Q.4 (a) Write a program in any language to create a threaded binary tree. 07
(b) Define an AVL tree. Obtain an AVL tree by inserting one integer at a 07
time in the following sequence.
150, 155, 160, 115, 110, 140, 120, 145, 130, 147, 170, 180.
Show all the steps.

Q.5 (a) What is hashing? Explain hash clash and its resolving techniques. 07
(b) Define File and Record. Explain Indexed-Sequential File. Also 07
discuss the advantages and disadvantages of the same.
OR
Q.5 (a) Define Hash Clash. Explain Primary Clustering, secondary clustering, 07
rehashing and double hashing.
(b) State different File Organizations and discuss the advantages and 07
disadvantages of each of them.

*************

2
Seat No.: _________ Enrolment No._______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE SEM-III Examination-Dec.-2011

Subject code: 130702 Date: 24/12/2011


Subject Name: Data & File Structure
Time: 2.30 pm -5.00 pm Total marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Answer the following 12


(i) What is Data Structure? Give the difference between
Linear and Non Linear Data Structures.
(ii) Give the difference between Simple Queue and Circular
Queue.
(iii) Define the terms with respect to graph: In-degree, Path,
Cycle.
(iv) Convert following Infix expression into Postfix and
Prefix expression.
a–b/c*d+e*f/g
(b) What do you mean by FIFO and LIFO? 02

Q.2 (a) Write an algorithm to implement PUSH, POP and CHANGE Operations on 07
Stack.
(b) Write short notes on following 07
(i). Storage representation of 2 Dimensional array
(ii).Advantages and disadvantages of linked list over array.

OR
(b) Write short note on following. 07
(i) Evaluation of Postfix Expression using Stack.
(ii) Applications of Trees.

Q.3 (a) Write an algorithm to insert and delete a node in Doubly Linked List. 08
(b) Write an algorithm/program to implement Delete operation into a Circular 06
Queue using array representation of Queue.

OR
Q.3 (a) Write an algorithm/program to implement following operations in the 08
“Singly Linked List”.
(i) Insert the node at end
(ii) Delete the node whose value = Y.

(b) Write an algorithm/program to implement insert operation into a Circular 06


Queue using array representation of Queue.

1
Q.4 (a) Create a Binary Search Tree for the following data and do in-order, 06
Preorder and Post-order traversal of the tree.
50, 60, 25, 40, 30, 70, 35, 10, 55, 65, 5
(b) Answer the following. 08
(i) What is recursion ? What care should be taken in writing
recursive function ? Give example of any one recursive
function.
(ii) Compare BFS and DFS traversal methods for Graph.
OR
Q.4 (a) What is Binary Search Tree? Write recursive algorithm/program to 06
implement in-order and pre-order traversal of the Binary Search Tree.
(b) How graph can be represented? Write an algorithm for Breadth First Search 08
Traversal of a Graph.

Q.5 (a) Write short notes on following 06


(i) Priority Queue.
(ii)Circular Linked List
(b) What do you mean by Hashing? Explain various methods for hashing. 08
OR
Q.5 (a) Write short notes on following 06
(i) Height Balanced Tree.
(ii) Dequeue
(b) What is File Structure? Explain Indexed Sequential File Structure in detail. 08

*************

2
Seat No.: _____ Enrolment No.______

GUJARAT TECHNOLOGICAL UNIVERSITY


BE SEM-III Examination May 2012
Subject code: 130702
Subject Name: Data and File Structure
Date: 15/05/2012 Time: 02.30 pm – 05.00 pm
Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is data structure? Explain linear and non-linear data structure with 03
example.
(b) Define Time complexity and Space complexity. Calculate time complexity 04
for given expression.
for (k=0; k<n; k++)
{
rows[k] = 0;
for(j=0; j<n; j++)
{
rows[k] = rows[k] + matrix[k][j];
total = total + matrix[k][j];
}
}
(c) Write a non-recursive algorithm for Preorder traversal of a binary tree. 07

Q.2 (a) Do as directed. 07


(1) What are the applications of the stack?
(2) First insert 10 and then insert 24. After these insertions, delete 37 and
then delete 22 from the following binary search tree. Draw the tree after
each operation.

(b) Answer the following questions. 07


(1) Given a two dimensional array Z1(2:9, 9:18) stored in column-major
order with base address 100 and size of each element is 4 bytes, find
address of the element Z1(4, 12).
(2) Write a short note on Weight balanced tree.
OR
(b) Answer the following questions. 07
(1) Explain insertion operation in the 2-3 tree: (i) if the parent has 2 children
and (ii) if the parent has 3 children.

1
(2) Write a short note on Index sequential file organization.

Q.3 (a) What is Tower of Hanoi? Explain it with n=3. 04


(b) Write an algorithm to convert infix expression into postfix expression with 05
parenthesis.
(c) Obtain the adjacency matrix A for the following graph. Find A2. Find 05
outdegree of E and D nodes.

OR
Q.3 (a) What is sparse matrix? Explain memory representation of sparse matrix. 04
(b) Differentiate between stack & queue. Also explain priority queue. 05
(c) Write a short note on Threaded binary tree. 05

Q.4 (a) Write an algorithm for circular queue that insert an element at rear end. 04
(b) Write a short on Breadth First Search and Depth First Search in graph. 05
(c) Explain the basic two techniques for Collision-resolution in Hashing with 05
example. Also explain primary clustering.
OR
Q.4 (a) Write an algorithm for Double Ended Queue that insert an element at front 04
end.
(b) Write a short note on Spanning tree. 05
(c) Insert 1, 29, 32 and 13 in the following Height balanced tree. For each 05
insertion, draw the balanced tree using AVL rotation.

Q.5 (a) Write an algorithm for inserting and deleting an element into circular linked 07
list.
(b) Explain terms: (1) Path (2) Graph 04
(c) Evaluate following prefix expression. 03
+*AB-C+C*BA (A= 4, B=8,C=12)
OR
Q.5 (a) Write an algorithm to insert a new node into orderly doubly linked list. 07
(b) Explain terms: (1) Cycle (2) Complete binary tree 04
(c) Write difference between singly linked list and doubly linked list. 03

*************
2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


B. E. - SEMESTER – III • EXAMINATION – WINTER 2012

Subject code: 130702 Date: 10-01-2013


Subject Name: Data and File Structure
Time: 10.30 am – 01.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Explain PUSH and POP operation of the stack with algorithm. 07
(b) Write an algorithm for insert operation at end of Linked List. 07

Q.2 (a) What is use of binary search tree? Construct sequential order binary tree 07
(binary search tree) for following values.
10,15,17,8,7,9,11,12,13,4,14,5
(b) Explain delete operation of doubley linked list. 07
OR
(b) What are the advantages of doubley linked list? Write a C function to find 07
maximum element from doubley linked list.

Q.3 (a) Convert following expression into postfix notation. 07


(i) A + ( B - C ) * D (ii) A ^ B * C \ D
(iii) (A + B) \ C * D ^ E

(b) Write a short note on threaded binary tree. 07

OR
Q.3 (a) Explain insert and delete function of circular queue. 07
(b) Find value of following postfix expression using stack trace. 07
(i) 546+*493 / + *
(ii) 3 5 * 6 2 / +.
Q.4 (a) Trace procedure to convert following forest into binary tree. 06

A
H

B C
I J K

D G
E
L

.
(b) Define : (i) Tree and binary tree (ii) intermediate node and leaf node 08
(iii) Sibling node and adjacent node (iv) path matrix.
OR
Q.4 (a) Find a post order and preorder traversal of a following tree. 07

B C

D E
G

Q.4 (b) Explain different Hash function methods. 07

Q.5 (a) Write a short note on indexed file organization. 07


(b) Explain DFS traversal of Graph using example. 07

OR
Q.5 (a) Write a short note on spanning tree. 07
(b) Write a short note on inverted key file organization. 07

*************
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III • EXAMINATION – SUMMER 2013
Subject Code: 130702 Date: 04-06-2013
Subject Name: Data and File Structure
Time: 02.30 pm - 05.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Define sparse matrix. Briefly explain representation of sparse matrix with the 07
help of link list and array.
(b) Define data structure. Briefly explain linear and non linear data structures 07
with their applications

Q.2 (a) Convert following infix expressions to the postfix expressions. Shows stack 07
trace.
A/B$C+D*E/F-G+H
(A+B)*D+E/(F+G*D)+C
(b) Write an algorithm for stack operations Push, Pop and Empty. Assume stack 07
is implemented using array
OR
(b) What is the advantage of postfix expression over infix expression? Write an 07
algorithm of postfix expression evaluation.

Q.3 (a) Write a C function search (l, x) that accepts a pointer l to a list of integers 07
and returns a pointer to a node containing x if it exists and the null pointer
otherwise.
(b) Write insert and remove functions for queue if it is implemented using 07
circular link list.
OR
Q.3 (a) Briefly explain advantages of doubly link list over singly link list. Write 07
function delete (p, &x) which delete the node pointed by p in doubly link list.
(b) Briefly explain advantages of binary search tree. Construct binary search tree 07
for the following elements
8,3,11,5,9,12,13,4,6,20

Q.4 (a) The inorder and preorder traversal of a binary tree are 07
dbeafcg
a b d e c f g respectively
Construct binary tree and find its postorder traversal.
(b) Define Directed graph, spanning tree and minimum spanning tree. Find 07
minimum spanning tree for the graph shown in Figure 1.
OR
Q.4 (a) Answer the following
1. The height of a binary tree is the maximum number of edges in any 01
root to leaf path. Define the maximum number of nodes in a binary
tree of height h.

2. Consider a B-tree in which the maximum number of keys in a node is


1/2
5. What is the minimum number of keys in any non-root node? 01
3. Define threaded binary tree. What are the advantages of threaded
binary tree? Give example of threaded binary tree. 05

(b) The Breadth First Search algorithm has been implemented using the queue 07
data structure. Find breadth first search for the graph shown in Figure 2 with
starting node M

Q.5 (a) The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty 07
hash table of length 10 using open addressing with hash function h(k) = k
mod 10 and linear probing. What is the resultant hash table?
(b) Define AVL tree. Construct AVL tree for following data 07
10,20,30,40,50,60,70,80
OR
Q.5 (a) What are the advantages of Multi way search tree over binary search tree? 07
Construct 2-3 tree for the following data
12, 50, 85, 6, 10, 37, 100, 120, 25, 70

(b) Define following 07


1. Strictly binary tree
2. Index sequential search
3. Hashing

*************

Figure 1

Figure 2

2/2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III • EXAMINATION – WINTER 2013
Subject Code: 130702 Date: 07-12-2013
Subject Name: Data and File Structure
Time: 02.30 pm - 05.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
Q.1 Answer the following. 14
(a) What do you mean by Data Structure? Give the difference between
Primitive and Non-primitive data structures.
(b) Explain Multidimensional Array. How it is stored in memory?
(c) Write a short note on threaded binary tree
(d) Convert following Infix expression into Postfix expression. Show each
step.
A + B ^ C^ D - E * F / G

Q.2 (a) What is Stack? Write down algorithms for performing POP and PEEP 07
operations on a stack.
(b) Answer the following. 07
(i) Compare Simple Queue and Circular Queue.
(ii) Define the following terms:
Path, Cycle, Degree of vertex, Sibling.
OR
(b) Write an algorithm to implement insert and delete operation into a Circular 07
Queue using array representation of Queue.

Q.3 Answer the following.(Any TWO) 14


(a) Write an algorithm/program to Delete a node from Doubly Linked List.
(b) Write an algorithm/program to “Insert a node at End” operation of Singly
Linked List.
(c) Define tree. Write an algorithm to do in-order traversal and post-order
traversals of Binary Search Tree.

Q.4 Answer the following.(Any TWO) 14


(a) Create a Binary Search Tree for the following data and do Inorder, Preorder
and Postorder traversal of the tree.
40, 65,25, 55, 10,70,30,50,15,80,75
(b) Define Graph. Write an algorithm to do BFS traversal of a Graph.
(c) Write short notes on (i) Height Balanced Tree. (ii) Indexed-Sequential
Files.

Q.5 Answer the following.(Any TWO) 14


(a) Explain matrix and linked list representation of a Graph. Also compare
BFS and DFS methods of Graph Traversal.
(b) What do you mean by Hashing? Explain any FOUR hashing techniques.
(c) Explain various multiple key access file organization in brief with
advantages and disadvantages of each method.

*************

1
2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III • EXAMINATION – SUMMER • 2014
Subject Code: 130702 Date: 04-06-2014
Subject Name: Data and File Structure
Time: 02.30 pm - 05.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Answer the following 10


i) Obtain the expression tree from the following post fix representation
ab+cde+**
ii) Define complete binary tree and a full binary tree
iii) List the features of a good hash function
iv) List the uses of stack, queue and linklists
v) What are priority queues? Explain it’s uses
(b) Evaluate the following postfix expression using stack 04
AB+CD/*GH*+ ((where A=2,B=4,C=6,D=3,G=8,H=7)
Q.2 (a) Write an algorithm to convert infix to postfix expression and explain it with 07
example
(b) Translate the following string into polish notation and trace the content of stack 07
A - ( B / C + (D % E * F) / G ) * H
OR
(b) i) Consider a dequeue given below which has LEFT=1, RIGHT=5 04
_ABCDE____.
Now perform the following operations on the dequeue
1. Add F on the left.
2. Add G on the right.
3. Add H on the right.
4. Delete two alphabets from left
5. Add I on the right
ii) Differentiate peep() and pop() functions 03
Q.3 (a) Write a program in any programming language to concatenate two doubly linked 07
lists.
(b) Write an algorithm to insert a node in an ordered linked list 07
OR
Q.3 (a) Give the preorder and Inorder traversal of the tree given in fig 1. 07
(b) Given the following traversals create a binary tree from that. Also give the 07
postorder traversal for the same.
preorder = {7,10,4,3,1,2,8,11}
inorder = {4,10,3,1,7,11,8,2}
Q.4 (a) Explain DFS and BFS with example 07
(b) Construct a binary search tree for the following sequence. Also do the inorder 07
and postorder traversal for the same
45,56,39,12,34,78,54,67,10,32,89,81
OR
Q.4 (a) What is a spanning tree? Find the minimum spanning tree for the graph shown in 07
fig 2.

1
(b) Write short notes on (i) Height Balanced Tree. (ii) Indexed-Sequential Files 07
Q.5 (a) What do you mean by Hashing? Explain any FOUR hashing techniques 07
(b) Define the following terms 07
i) Node
ii) Sibling
iii) Path
iv) Indegree & outdegree of a vertex
v) Connected graph
OR
Q.5 (a) Compare and contrast Prim’s and Kruskal’s algorithm with the help of an 07
example
(b) Explain AVL tree with the help of an example also show insertion and deletion 07
with the help of an example.

Fig: 1. Fig :2

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III • EXAMINATION – WINTER • 2014
Subject Code: 130702 Date: 01-01-2015
Subject Name: Data and File Structure
Time: 02.30 pm - 05.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is data structure? Explain linear and non-linear data structure with 03
example.
(b) Discuss best case, average case and worst case time analysis with example. 04
(c) Explain PUSH and POP operation of the stack with algorithm. 07
Q.2 (a) Write an algorithm to perform insert and delete operation on single queue. 07
(b) (a) Convert the following infix expression to postfix prefix form. 07
(( A –( B +C))* D) $ ( E +F )
(b) Evaluate the following infix expression.
2 $3+5*2$2–6/6
OR
(b) Define the following term : Path, Cycle, Degree of vertex, Sibling, Height 07
Balanced Tree, Strictly binary tree, in degree
Q.3 (a) Explain delete operation in doubly link list. 07
(b) What is the difference between queue & Dqueue . Explain insertion operation in 07
Dqueue.
OR
Q.3 (a) Write an algorithm to reverse a given single link list. 07
(b) Create a binary search tree by inserting following nodes in sequence. 07
68,85,23,38,44,80,30,108,26,5,92,60
Write inorder,preorder and post order traversal of the above generated Binary
search tree.
Q.4 (a) Write an algorithm to perform traversal of Binary search tree 07
(b) Explain AVL tree with the help of an example also show insertion and deletion 07
with the help of an example.
OR
(a) Write a short note on :spanning tree , threaded binary tree 07
(b) Explain the basic two techniques for Collision-resolution in Hashing with 07
example. Also explain primary clustering.
Q.5 (a) Compare and contrast Prim’s and Kruskal’s algorithm with the help of an 07
example
(b) Explain various multiple key access file organization in brief with 07
advantages and disadvantages of each method.
OR
Q.5 (a) What do you mean by Hashing? Explain any FOUR hashing techniques 07
(b) Explain and differentiate BFS and DFS graph traversal method with suitable 07
graph.

*************

1
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–III • EXAMINATION – WINTER • 2014
Subject Code: 2130702 Date: 01-01-2015
Subject Name: Data Structure
Time: 02.30 pm - 05.00 pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Write short note on performance analysis and performance measurement of an 07
algorithm.
(b) Write a selection sort algorithm and also discuss its efficiency. 07
Q.2 (a) What is Stack? List out different operation of it and write algorithm for any two 07
operation.
(b) Write a 'C' program or an algorithm to convert infix expression without parenthesis to 07
postfix expression.
OR
(b) Write user defined C function for inserting an element into circular queue. 07
Q.3 (a) What is a Queue? Write down drawback of simple queue. Also write an algorithm for 07
deleting an element from circular queue
(b) Write down advantages of linked list over array and explain it in detail. 07
OR
Q.3 (a) Write an algorithm to delete a node from doubly linked list. 07
(b) Convert A+(B*C-(D/E^F)*G) infix expression into postfix format showing stack 07
status after every step in tabular form.
Q.4 (a) Define the following terms. 1) Graph 2) Tree 3) Multi graph 4) Weighted graph 07
5) Elementary path 6) Complete Binary tree 7) Descendent node
(b) List out different traversal way of tree and demonstrate any two with example. 07
OR
Q.4 (a) Write an algorithm to delete a node from tree. 07
(b) Explain BFS and DFS in detail. 07
Q.5 (a) Explain AVL tree with example. 07
(b) List out different hash methods and explain any three. 07
OR
Q.5 (a) Write down precondition and algorithm of binary search method. 07
(b) Explain file in terms of fields, records and database. 07

*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE – SEMESTER III– • EXAMINATION – SUMMER 2015

Subject Code:130702 Date:09/06/2015


Subject Name: Data and File structure
Time: 02.30pm-05.00pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) 07
(i) Write algorithm to sum values in vector V and find out the execution time 04
required.
(ii) Explain the equation that finds out the address of the element of the one 03
dimensional array. Assume necessary data.
(b) 07
(i) Convert the following Polish(prefix) expression to Reverse Polish(suffix) 04
notation
a. ++abc
b. +a+bc
c. +a*bc
d. *a+bc
(ii) Does a time sharing computer use a queue or stack? Explain. 03
Q.2 (a) Write an algorithm for inserting a node and deleting a node in doubly linked linear 07
list.
(b) Write steps of procedure to insert an element to the top of the stack and remove 07
top element from a stack.
OR
(b) What is the advantage of Polish expression over infix notation? Write an 07
algorithm to convert an infix expression into reverse Polish expression.
Q.3 (a) 07
(i) Write a recursive algorithm to find factorial. 04
(ii) Which type of allocation is called linked allocation? Define singly linked 03
linear list.
(b) 07
(i) Explain the threaded storage representation for binary trees. 04
(ii) Define the inorder, postorder and preorder traversal for the following tree. 03
A

B D

C E G

OR
Q.3 (a) 07
(i) What are the advantages of circular lists over singly linked list? 04
(ii) Explain – Why doubly linked lists are much more efficient with respect to 03
deletions than singly linked lists?

1
(b) 07
(i) Define adjacency matrix. When two digraphs are considered to be 04
equivalent?
(ii) Explain the breadth first search and depth first search tree traversal on the 03
following graph.
A

B
C D E

Q.4 (a) Write an algorithm for inserting and deleting an element from queue. 07
(b) 07
(i) Define 2-3 tree. Describe the characteristic of 2-3 tree. 04
(ii) Write the characteristics of AVL tree. 03
OR
Q.4 (a) What is a circular queue? Write an algorithm for inserting and deleting an element 07
from a circular queue.
(b) 07
(i) Explain the structure of sequential file. 04
(ii) Explain the structure of indexed sequential files. 03
Q.5 (a) What is collision? Explain two broad classes of collision resolution techniques. 07
(b) Explain the binary search method. Write an algorithm for performing a binary 07
search.
OR
Q.5 (a) What is hashing? Explain hashing functions. 07
(b) Explain the multi key file organization and access methods. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III (NEW) EXAMINATION – SUMMER 2015

Subject Code: 2130702 Date:09/06/2015


Subject Name: DATA STRUCTURE
Time: 02.30pm-05.00pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Write a ‘C’ program for insertion sort and discuss its efficiency. 07
(b) Briefly explain various linear and non-linear data structures along with their 07
applications.
Q.2 (a) Write ‘C’ functions to: (1) insert a node at the end (2) delete a node from the 07
beginning of a doubly linked list.
(b) Write an algorithm to reverse a string of characters using stack. 07

OR
(b) Compare: (1) Linked-list and Array (2) Circular queue and Simple Queue. 07

Q.3 (a) Convert (A + B) * C – D ^ E ^ (F * G) infix expression into prefix format 07


showing stack status after every step in tabular form.
(b) Write an algorithm to implement insert and delete operations in a simple queue. 07

OR
Q.3 (a) Describe: (1) Recursion (2) Priority Queue (3) Tower of Hanoi 07
(b) Write a ‘C’ functions to: (1) insert a node at beginning in singly linked list (2) 07
insert an element in circular queue.
Q.4 (a) With figure, explain the following terms: (1) Depth of a tree (2) Sibling nodes (3) 07
Strictly binary tree (4) Ancestor nodes (5) Graph (6) Minimum spanning tree (7)
Degree of a vertex
(b) Generate a binary search tree for following numbers and perform in-order and 07
post-order traversals: 50, 40, 80, 20, 0, 30, 10, 90, 60, 70
OR
Q.4 (a) Explain Right-in-threaded, left-in-threaded and full-in-threaded binary trees. 07
(b) Write Kruskal’s algorithm for minimum spanning tree and explain with an 07
example.
Q.5 (a) Describe various collision resolution techniques in hashing. 07
(b) Write an algorithm for binary search method and discuss its efficiency. 07

OR
Q.5 (a) Explain Sequential, Indexed Sequential and Random file organizations. 07
(b) Write recursive ‘C’ functions for (1) in-order (2) pre-order and (3) post-order 07
traversals of binary search tree.

*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III EXAMINATION – WINTER 2015

Subject Code:130702 Date:02/01/2016


Subject Name: Data and File Structure
Time: 2:30pm to 5:00pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What does abstract data type means? Briefly explain linear and non linear data 07
structures.

(b) Given a two dimensional array A1(1:8, 7:14) stored in row-major order with base 07
address 100 and size of each element is 4 bytes, find address of the element A1(4, 12).

Q.2 (a) Write an algorithm to implement PUSH and POP Operations on Stack. 07

(b) Write an algorithm for evaluation of postfix expression and evaluate the 07
following expression showing every status of stack in tabular form.
 562-*493/+*
OR
(b) Enlist difference between recursive and iterative algorithms. Write any one 07
recursive function showing the stack contents while function call and return.
Q.3 (a) Write a program to perform insert and delete routines on a queue. 07
(b) Write advantages and disadvantages of linked list, doubly linked list and 07
circular linked list with example.
OR
Q.3 (a) Explain priority queue and dequeue. Write an algorithm/program for insert 07
routine in input restricted dequeues.
(b) Write a program to search an element in a linked list. 07

Q.4 (a) Create a Binary Search Tree for the following data and do in-order, Preorder 07
and Post-order traversal of the tree.
40, 60, 15, 4, 30, 70, 65, 10, 95, 25, 34

(b) Define the following with example : 07


 Strictly binary tree
 Complete binary tree
OR
Q.4 (a) What is Binary Search Tree? Write recursive algorithm/program to implement 07
in-order traversal of the Binary Search Tree.

1
(b) Define height balanced tree. Construct a height balanced binary tree (AVL tree) 07
for the following data
32,16,44,52,78,40,12,22,02,23

Q.5 (a) What is hashing? Briefly explain various methods of hashing. 07


(b) Explain with example DFS and BFS traversal of graph. 07
OR
Q.5 (a) What is File Structure? Explain any one File Structure in detail. 07
(b) Show how graph can be represented using example? How path matrix can be 07
found out using adjacency matrix.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (New) EXAMINATION – WINTER 2015

Subject Code:2130702 Date:02/01/2016


Subject Name: Data Structures
Time: 2:30pm to 5:00pm Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

MARKS
Q.1 Short Questions 14
1 Define data structure. 1
2 List operations performed on a stack. 1
3 Mention variations of the queue data structure. 1
4 What is the worst case time complexity of searching an 1
element in a list? How?
5 Mention one operation for which use of doubly linked 1
list is preferred over the singly linked list.
6 Write an algorithm/steps to traverse a singly linked list. 1
7 Define: Height of a tree. 1
8 What is the height of a complete binary with n nodes? 1
9 Write two simple hash functions. 1
10 What is a header node and what is its use? 1
11 Is Queue a priority queue? Justify. 1
12 What is the complexity of binary search algorithm? 1
13 Name two divide and conquer algorithms for sorting. 1
14 Give two applications of graphs. 1
Q.2 (a) Write an algorithm to check if an expression has 03
balanced parenthesis using stack.
(b) What is postfix notation? What are its advantages? 04
Convert the following infix expression to postfix.
A$B-C*D+E$F/G
(c) Write a C program to implement a stack with all 07
necessary overflow and underflow checks using array.
OR
(c) Write a C program to implement a circular queue using 07
array with all necessary overflow and underflow checks.
Q.3 (a) Evaluate the following postfix expression using a stack. 03
Show the stack contents.
AB*CD$-EF/G/+
A=5, B=2, C=3, D=2, E=8, F=2, G=2
(b) Perform following operations in a circular queue of 04
length 4 and give the Front, Rear and Size of the queue
after each operation.
1) Insert A, B
2) Insert C
3) Delete
4) Insert D
1
5) Insert E
6) Insert F
7) Delete
(c) Write a program to insert and delete an element after a 07
given node in a singly linked list.
OR
Q.3 (a) Explain various applications of queue. 03
(b) Differentiate between arrays and linked list. 04
(c) Create a doubly circularly linked list and write a 07
function to traverse it.
Q.4 (a) Define complete binary tree and almost complete binary 03
tree.
(b) Explain deletion in an AVL tree with a suitable 04
example.
(c) What is binary tree traversal? What are the various 07
traversal methods? Explain any two with suitable
example.
OR
Q.4 (a) Mention the properties of a B-Tree. 03
(b) Construct a binary tree from the traversals given below: 04
Inorder: 1, 10, 11, 12, 13, 14, 15, 17, 18, 21
Postorder: 1, 11, 12, 10, 14, 18, 21, 17, 15, 13
(c) What is a binary search tree? Create a binary search tree 07
for inserting the following data.
50, 45, 100, 25, 49, 120, 105, 46, 90, 95
Explain deletion in the above tree.
Q.5 (a) Insert the following elements in a B-Tree. 03
a, g, f, b, k, c, h, n, j
(b) Apply quicksort algorithm to sort the following data. 04
Justify the steps.
42, 29, 74, 11, 65, 58
(c) What is hashing? What are the qualities of a good hash 07
function? Explain any two hash functions in detail.
OR
Q.5 (a) List advantages and disadvantages of Breadth First 03
Search and Depth First Search.
(b) What is a minimum spanning tree? Explain Kruskal’s 04
algorithm for finding a minimum spanning tree.
(c) Discuss various methods to resolve hash collision with 07
suitable examples.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III EXAMINATION – SUMMER 2016

Subject Code:130702 Date:09/06/2016


Subject Name:Data and File Structure
Time:10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Give various applications of stack and queue. 06


(b) What is a binary search tree? Explain with an example and state its applications. 05
Also explain deletion in a binary search tree.
(c) Discuss the advantages and disadvantages of linked list over array. 03

Q.2 (a) Write a ‘C’ program to implement a stack. Do check for overflow and 07
underflow.
(b) What is hashing? Explain the collision resolution techniques. 07
OR
(b) Define recursion. What care should be taken in writing recursive function? 07
Give a recursive solution for the problem of “Towers of Hanoi”.
Q.3 (a) Consider a circular queue of size 6. 07
Let Front =2, Rear =4, and Queue : __, L, M, N, __, __
Describe the queue as following operations are performed.
1) Add O
2) Add P
3) Delete
4) Delete
5) Add Q, R, S
6) Delete
(b) What is importance of postfix notation? Write the algorithm for converting 07
an infix expression to postfix notation.
OR
Q.3 (a) Convert the following expression to postfix notation. Show the contents of 07
the stack while conversion.
12 / (7 - 3) + 2 * (1 + 5)
(b) What is a priority queue? Discuss the array implementation of priority queue. 07
Q.4 (a) Write an algorithm to insert a node before a given node in a singly linked list. 07
Is it advantageous to use a doubly linked list for this operation? Explain.

(b) Create a B-tree of order 5 by inserting the following data values. 07


D, H, K, Z, B, P, Q, E, A, S, W, T, C, L, N, Y, M
OR
Q.4 (a) What is an AVL tree? Explain the different types of rotations used to create 07
an AVL tree with suitable examples.
(b) Construct an expression tree for the following expression. 07
A+(B+C*D+E)+F/G.
Make a preorder traversal of the resultant tree.

1
Q.5 (a) A binary tree T has 9 nodes. The inorder and preorder traversals of T give the 07
following sequence of nodes.
Inorder: E A C K F H D B G
Preorder: F A E K C D H G B
Draw the tree T.
(b) What is a graph? Discuss the Adjacency Matrix and Adjacency List 07
representation of graphs with an example.
OR
Q.5 (a) Define the following with respect to a graph: 07
1) Path 2) degree 3) Cycle 4) Spanning tree 5) Directed Graph
(b) Consider the following graph: Create a minimum spanning tree using the 07
Kruskal’s algorithm.

B C D E

G H

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III(New) EXAMINATION – SUMMER 2016

Subject Code:2130702 Date:09/06/2016


Subject Name:Data Structure
Time:10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS
Q.1 Short Questions 14
1 Define primitive data structure.
2 Explain space and time complexity.
3 What is the time complexity of Quicksort algorithm in the worst
case?
4 List the applications of Stack.
5 Define graph.
6 Explain degree of a vertex in a graph.
7 List the applications of Graphs.
8 List the applications of Binary trees.
9 Define B-Tree.
10 Describe the time complexity of Binary search algorithm.
11 What is hash collision?
12 Write ‘C’ structure of Binary tree.
13 Write ‘C’ structure of Singly linked list.
14 Define priority queue.
Q.2 (a) Write an algorithm for simple queue with ENQUEUE operations. 03
(b) Write an algorithm to reverse a string using stack. 04
(c) Write a program to implement stack using linked list. 07
OR
(c) Write a program to implement circular queue using array. 07
Q.3 (a) Evaluate the following postfix expression using stack: 03
(a) 9 3 4 * 8 + 4 / - (b) 5 6 2 + * 1 2 4 / - +
(b) Explain the concept of circular queue. Compare circular queue with 04
simple queue.
(c) Explain insert and delete operations in AVL trees with suitable 07
examples.
OR
Q.3 (a) Explain double ended queue. 03
(b) Write ‘C’ functions to implement DELETE_FIRST_NODE and 04
TRAVERSE operations in doubly linked list.
(c) With a suitable example, explain steps for conversion of a general 07
tree into a binary tree.
Q.4 (a) Explain Sequential search method. 03
(b) Explain Threaded binary trees with suitable examples. 04
(c) Write an algorithm for Selection sort method. Explain each step 07
with an example.
OR
Q.4 (a) Explain Depth First Search in graphs with an example. 03
(b) Explain Binary search method. 04

1
(c) Write an algorithm for Insertion sort method. Explain each step with 07
an example.
Q.5 (a) Explain Breadth First Search in graphs with an example. 03
(b) Construct a binary tree from the traversals given below: 04
Inorder: 1 3 4 6 7 8 10 13 14
Preorder: 8 3 1 6 4 7 10 14 13
(c) Explain various Hash collision resolution techniques with examples. 07
OR
Q.5 (a) Explain Sequential file organizations and list its advantages and 03
disadvantages.
(b) Draw a Binary expression tree for the following and perform 04
preorder traversal: (A $ B $ C) + (D – E * F)
(c) Write Prim’s algorithm for minimum spanning tree with an 07
example.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III(OLD) • EXAMINATION – WINTER 2016
Subject Code:130702 Date:04/01/2017
Subject Name:Data and File Structure
Time: 10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is data structure? Explain different types of data structures with 07
applications.
(b) Derive the formula to calculate address A[i, j] of 2-D array, for a Row-major 07
order storage representation.
A 2-D array defined as A[r, c] where 1 ≤ r ≤ 4, 5≤ c ≤ 8, requires 2 bytes of
memory for each element. If the array is stored in Row-major order form,
calculate the address of A[3,7] given the Base address as 2000.
Q.2 (a) Discuss and compare array and linked list. 07
(b) Discuss importance of hashing. Also discuss one of the method of hashing with 07
an example.
OR
(b) Discuss the structure of sequential and indexed file organization. 07
Q.3 (a) Write algorithm OR code for PUSH, POP and DISPLAY function of the 07
STACK.
(b) Convert the following infix expression to postfix form using Stack. 07
(( A – (B + C)) × D) / (E + F)
OR
Q.3 (a) Write algorithm OR code for INSERT, DELETE and DISPLAY function of the 07
QUEUE.
(b) What is a priority queue? Discuss the array implementation of priority queue. 07
Q.4 (a) Write C code to insert a node at the end of a doubly link list. 07
(b) Write an algorithm to merge two simple link lists having initial address L1 and 07
L2 respectively. Also write algorithm to display the list.
OR
Q.4 (a) Write algorithm OR code for DELETE and DISPLAY functions of Circular 07
Link List.
(b) Write C code for the following operations for a simple link list. 07
i. Reverse : to reverse the link list
ii. Max : to find the largest element from the link list.
Q.5 (a) Write a non-recursive algorithm for Preorder traversal of a binary tree 07
(b) What is a sparse matrix? Explain memory representation of a sparse matrix. 07
OR
Q.5 (a) Discuss DFS and BFS. 07
(b) Discuss Inorder and Postorder traversal of a binary tree. 07

*************

1
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–III(New) • EXAMINATION – WINTER 2016
Subject Code:2130702 Date:02/01/2017
Subject Name:Data Structure
Time:10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

MARKS
Q.1 Explain the following terms in brief 14
1 Primitive data structure
2 Non-primitive data structure
3 Linear data structure
4 Non-linear data structure
5 Recursion
6 Time complexity of an algorithm
7 Double-ended queue
8 Priority queue
9 Circular linked list
10 Complete binary tree
11 2-3 tree
12 Minimum spanning tree
13 Degree of vertex
14 Hash collision
Q.2 (a) Write a pseudo-code for PUSH and POP operations of 03
stack.
(b) What is prefix notation? Convert the following infix 04
expression into prefix.
A+B–C*D*E$F$G
(c) Write an algorithm to perform various operations (insert, 07
delete and display) for simple queue.
OR
(c) Write differences between simple queue and circular 07
queue. Write an algorithm for insert and delete operations
for circular queue.
Q.3 (a) Convert the following infix expression into postfix. 03
A+B–C*D*E$F$G
(b) Write algorithm(s) to perform INSERT_FIRST (to insert 04
a node at the first position) and REVERSE_TRAVERSE
(to display the data in nodes in reverse order) operations
in doubly linked list.
(c) Write a ‘C’ program to implement stack using linked list. 07
OR
Q.3 (a) Enlist and briefly explain various applications of stack. 03
(b) Discuss various rehashing techniques. 04
(c) Write ‘C’ functions to implement INSERT_FIRST (to 07
insert a node at the first position), DELETE_FIRST (to
delete a node from the first position), DELETE_LAST
(delete a node from the last position) and TRAVERSE (to
display the data in nodes) operations in circular linked
list.
1
Q.4 (a) Write an algorithm for Binary search method. 03
(b) Write a ‘C’ program for Bubble sort. 04
(c) Sort the following numbers using (i) Selection sort (ii) 07
Quick sort:
10 50 0 20 30 10
OR
Q.4 (a) Write a ‘C’ function for Selection sort. 03
(b) Write an algorithm for Quick sort. 04
(c) Explain Depth First Search and Breadth First Search in 07
graphs with an example.
Q.5 (a) Draw a binary expression tree for the following and 03
perform preorder traversal for the same:
(A + B $ C) + (D + E * F)
(b) Construct a binary search tree for the following and 04
perform inorder and postorder traversals:
5 9 4 8 2 1 3 7 6
(c) Write ‘C’ functions for: inserting a node, postorder 07
traversal and counting total number of nodes for binary
search tree.
OR
Q.5 (a) Explain AVL trees. 03
(b) Construct a binary search tree from the following 04
traversals:
Inorder: 3 4 5 6 7 9 17 20 22
Preorder: 9 4 3 6 5 7 17 22 20
(c) Write Kruskal’s algorithm for minimum spanning tree with 07
an example.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (NEW) - EXAMINATION – SUMMER 2017
Subject Code: 2130702 Date: 31/05/2017
Subject Name: Data Structure
Time: 10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

MARKS
Q.1 Short Questions 14
1 Arithmetic expression evaluation is an explanation of which 1
data structure?
2 How many stacks are needed to implement a queue. Consider 1
the situation where no other data structure like arrays, linked
list is available.
3 A graph containing only isolated nodes is called a ___. 1
4 What is the 2’s complement representation for integer 5 in 1
modulo 16?
5 What is the result of 7+7 using 2’s complement representation 1
and modulo 16 arithmetic.
6 In which type of tree, each leaf node is kept at the same 1
distance from root?
7 What is the reverse polish notation for infix expression a / b
*c ? 1
8 What does the following function do for a given Linked List 1
with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;

fun1(head->next);
printf("%d ", head->data);
}
9 Which of the traversal technique outputs the data in sorted 1
order in a Binary Search Tree?
10 What is common in inorder, preorder and postorder traversal? 1

11 For sorting 1 GB of data with only 100 MB of available main 1


memory. Which sorting technique will be most appropriate?

12 In 2-3 trees, what do leaves contain and what do nonleaf nodes 1


indicate?
13 Consider a situation where swap operation is very costly. 1
Which of the sorting algorithms should be preferred so that the
number of swap operations are minimized in general?

14 Draw tree whose postorder traversal is C B F E G D A 1

1
Q.2 (a) Write an algorithm for finding average of given numbers. 03
Calculate time complexity.
(b) Given Inorder and Preorder traversal, find Postorder traversal. 04
Inorder traversal = {4, 2, 5, 1, 3, 6}
Preorder traversal = {1, 2, 4, 5, 3, 6}

(c) Consider an example where the size of the queue is four 07


elements. Initially the queue is empty. It is required to insert
symbols ‘A’,’B’ and ‘C’. delete ‘A’ and ‘B’ and insert ‘D’ and
‘E’. Show the trace of the contents of the queue.

OR
(c) Insertion sequence of names is 07
Norma, Roger,John,Bill,Leo,Paul, Ken and Maurice
(i) Show the behavior of creating a lexically ordered
binary tree.
(ii) Insert Kirk. Show the binary tree.
(iii)Delete John. Show the binary tree.
Q.3 (a) Write an algorithm to return the value of ith element from top 03
of the stack.
(b) Write an algorithm for inserting an element in a stack, 04
removing an element from stack .
(c) Write algorithm for inserting and deleting an element in 07
circular queue.
OR
Q.3 (a) Consider the expression v1*v2-(v3+v4^v5). Show the tree 03
corresponding to the expression.
(b) What is an ordered tree? What is forest? 04
(c) Explain the structure of indexed sequential file. 07
Q.4 (a) Consider singly linked storage structures,Write an algorithm 03
which inserts a node into a linked linear list in a stack like
manner.
(b) How open addressing can be used for collision resolution? 04

(c) Explain structure of sequential file. Explain processing in 07


sequential file.
OR
Q.4 (a) Consider singly linked storage structures,Write an algorithm 03
which performs an insertion at the end of a linked linear list.

(b) Give definitions 04


(i) Graph
(ii) Adjacent nodes
(c) What is priority queue? Explain the array representation of 07
priority queue.
Q.5 (a) Explain outdegree and indegree. 03
(b) Explain Depth First Search operation. 04
(c) Explain the trace of selection sort on following data. 07
42,23,74,11,65,58,94,36,99,87
OR
Q.5 (a) Write and explain application of queue. 03
(b) Explain Breadth First Search operation. 04
(c) Explain the trace of bubble sort on following data. 07
42,23,74,11,65,58,94,36,99,87

*************
2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (OLD) - EXAMINATION – SUMMER 2017
Subject Code: 130702 Date: 02/06/2017
Subject Name: Data and File Structure
Time: 10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What does abstract data type means? Briefly explain linear and non linear data 07
structures.
(b) Explain PUSH and POP operation of the stack with algorithm. 07
Q.2 (a) Convert following infix expressions to the postfix expressions. Shows stack 07
trace.
A/B$C+D*E/F-G+H
(A+B)*D+E/(F+G*D)+C
(b) Write an algorithm to convert infix to postfix expression and explain it with 07
example.
OR
(b) Write a Program to perform insert and delete operations on a circular Queue. 07
Q.3 (a) Define recursion. What care should be taken in writing recursive function? Give 07
a recursive solution for the problem of “Towers of Hanoi”.
(b) Write an algorithm to insert and delete a node in Doubly Linked List. 07
OR
Q.3 (a) Differentiate between stack & queue. Also explain priority queue with example. 07
(b) Write a program to search an element in a linked list. 07
Q.4 (a) Create a Binary Search Tree for the following data and do in-order, Preorder and 07
Post-order traversal of the tree.
40, 60, 15, 4, 30, 70, 65, 10, 95, 25, 34
(b) Define the following with example : 07
 Strictly binary tree
 Complete binary tree
OR
Q.4 (a) How graph can be represented? Write an algorithm for Breadth First Search 07
Traversal of a Graph.
(b) What is an AVL tree? Explain the different types of rotations used to create an 07
AVL tree with suitable examples.
Q.5 (a) What is hashing? Explain hashing functions. 07
(b) Write a short note on inverted key file organization 07
OR
Q.5 (a) Define Hash Clash. Explain Primary Clustering, secondary clustering, rehashing 07
and double hashing.
(b) Write a short note on indexed file organization. 07

*************

1
Seat No.: ________ Enrolment No.___________
GUJARAT TECHNOLOGICAL UNIVERSITY
BE - SEMESTER–III (NEW) - EXAMINATION – SUMMER 2018
Subject Code:2130702 Date:21/05/2018
Subject Name:Data Structure
Time:10:30 AM to 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

MARKS
Q.1 (a) Differentiate between linear and non linear data structures. 03
(b) Discuss the variations of a queue. 04
(c) Write an algorithm to convert an infix expression to postfix expression. 07
Show the working of the algorithm for the following expression.
A+B*C/D$E-(F*G)

Q.2 (a) Evaluate the following postfix expression using a stack. Show the steps. 03
2 $ 3 + 5 * 2 $ 2 – 12 $ 6
(b) Consider the stack S of characters, where S is allocated 8 memory cells. 04
S: A,C,D, F, K, _, _, _
Describe the stack as the following operations take place.
Pop(), Pop() ,Push(L), Push(P), Pop(), Push(R), Push (S), Pop()
(c) Write a program to implement queue and check for boundary conditions. 07
OR
(c) Write a program to implement a circularly linked list. 07

Q.3 (a) List the advantages of a doubly linked list over singly linked list. 03
(b) Write an algorithm to swap two nodes, n and n+1, in a singly linked list. 04
(c) Perform inorder, postorder and preorder traversals for the following 07
binary tree.

What is the peculiarity of the inorder traversal?


OR
Q.3 (a) What is a header node? Explain its importance. 03
(b) Write an algorithm to count the number of nodes in a singly circularly 04
linked list.
(c) What is a binary search tree? Create a binary search tree for the 07
following data.
14, 10, 17, 12, 10, 11, 20, 12, 18, 25, 20, 8, 22, 11, 23
Explain deleting node 20 in the resultant binary search tree.

Q.4 (a) Explain the working of the Kruskal’s algorithm. 03


(b) Write the algorithm for binary search and find its complexity. 04
(c) Insert the following letters into an empty B-tree of order 5: 07
CNGAHEKQMFWLTZDPRXYS
1
OR
Q.4 (a) Define the following terms with respect to a graph: Node, Edge, Path 03
(b) Discuss different representations of a graph. 04
(c) Apply Djkstra’s algorithm for the following graph with Node S as the 07
starting node.

Q.5 (a) What is the complexity of the quick sort algorithm on sorted data? 03
Justify your answer.
(b) What is hashing? Explain hash collision and any one collision resolution 04
technique.
(c) Explain the difference between insertion sort and selection sort with an 07
example. What is the time complexity of these algorithms? How?
OR
Q.5 (a) List the qualities of a good hash function. 03
(b) Explain two hash functions. 04
(c) Apply merge sort algorithm for the following data and show the steps. 07
66, 33, 40, 22, 55, 88, 11, 80, 20, 50, 44, 77, 30

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (New) EXAMINATION – WINTER 2018
Subject Code: 2130702 Date:28/11/2018
Subject Name: Data Structure
Time: 10:30 AM TO 01:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) What is Recursion? Write a pseudocode in ‘C’ language to find the 03
multiplication of two natural numbers.
(b) Differentiate between Stack and Queue. 04
(c) Write algorithms for Push and Pop operations on a stack. 07
Q.2 (a) Convert Infix Expression A ^ B * C - D + E / F / (G + H) into Postfix 03
expression using stack.
(b) Explain average case timing analysis for Search Algorithm. 04
(c) Write an algorithms to convert Infix Expression(without parenthesis) into 07
Postfix Expression
OR
(c) Write algorithms for Insert and Delete operation in Circular Queue. 07
Q.3 (a) Evaluate the Postfix Expression 6 2 3 + - 3 8 2 / + * 2 $ 3 + using Stack. 03

(b) Write an algorithm for insertion of node at last position in Liner Linked List. 04

(c) Create a Binary Search Tree for the following data and do Inorder, Preorder 07
and Postorder traversal of the tree.
45, 70,30, 60, 15,75,35,55,20,85,80
OR
Q.3 (a) Explain Priority Queue? 03
(b) Write an algorithm for deletion of node in Liner Linked List. 04
(c) What is Binary Search Tree? Construct a binary search tree for the 07
following elements
11,6,14,8,12,15,16,7,9,23
Q.4 (a) Write an algorithm for Bubble sort. 03
(b) Write an algorithm for insertion of a node in Doubly Linked List. 04
(c) What is hashing? Explain Different Hashing techniques in brief. 07
OR
Q.4 (a) Write an algorithm for Selection sort. 03
(b) Write an algorithm for deletion of a node in Doubly Linked List. 04
(c) What is hashing? Explain hash clash and its resolving techniques. 07

Q.5 (a) Explain spanning tree with example. 03


(b) Write an algorithm for Sequential Search. 04
(c) Explain different types of File Organizations and discuss the advantages and 07
disadvantages of each of them.
OR
Q.5 (a) What is Topological sorting? 03
(b) Write an algorithm for Binary Search. 04
(c) Explain Sequential Files and Indexed Sequential Files Structures. 07

*************
1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (NEW) EXAMINATION – SUMMER 2019
Subject Code: 2130702 Date: 04/06/2019
Subject Name: Data Structure
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
MARKS

Q.1 (a) Define Data Structure and differentiate between linear and nonlinear 03
data structures.
(b) Write a pseudocode for PUSH and POP operations of stack. 04
(c) Write algorithm for inserting an element in circular queue and deleting 07
a node from a singly linked list.
Q.2 (a) Illustrate the working of priority queue with suitable example. 03
(b) Write recursive algorithm to compute factorial of a given number. 04
Which data structure can be used to implement this algorithm?
(c) Sort the following numbers in ascending order by applying quick sort. 07
29 15 11 82 22 17 53 57 4 8
OR
(c) “If no interchanges occurred, then all the elements must be sorted and 07
no further passes are required.” Which sorting technique works on this
principal? Apply the same sorting technique on the following data to
sort them in ascending order.
11, 15, 13, 14, 2, 8, 10
Q.3 (a) Evaluate the following postfix expression in tabular form showing 03
stack after every step.
7 6 + 4 * 4 10 + - 5 +
(b) Write the algorithm for binary search. 04
(c) Explain the working of the Prim’s algorithm with suitable example. 07
OR
Q.3 (a) List the advantages of a doubly linked list over singly linked list. 03
(b) List out graph traversal techniques & explain any one using suitable 04
example.
(c) Apply Djkstra’s algorithm on following graph with Node A as the 07
starting node.

Q.4 (a) Explain Sequential search method with suitable example. 03


(b) Given Inorder and Preorder traversal, find Postorder traversal. 04
Inorder:Y B K C F A G X E D H Z
Preorder:G B Y A C K F X D E Z H
(c) Explain collision in the context of hashing? Discuss collision 07
resolution techniques.
1
OR
Q.4 (a) Explain indexing structure for index files. 03
(b) Draw a Binary expression tree for the following and perform preorder 04
traversal:
a*(b+c)+(d*e)/f+g*h
(c) Explain insert and delete operations in AVL trees with suitable 07
examples.
Q.5 (a) Define: i) Cyclic Graph ii) Siblings iii) Strictly Binary Tree 03
(b) Explain Threaded binary trees with suitable examples. 04
(c) Write a C program to reverse a string using stack. 07
OR
Q.5 (a) Explain Sequential file organizations and list its advantages and 03
disadvantages.
(b) Write an algorithm for insertion sort. 04
(c) Discuss different representations of a graph. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III (New) EXAMINATION – WINTER 2019
Subject Code: 2130702 Date: 28/11/2019
Subject Name: Data Structure
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Define primitive and non-primitive data types with example. 03
(b) Differentiate linear and non-linear data structures. 04
(c) Write algorithms for PUSH and POP stack operations. 07

Q.2 (a) Enlist applications of stack and queue. 03


(b) Evaluate the following postfix expression using stack. Show each step. 04
5 3 + 6 2 / * 3 5 * +
(c) Write a C functions for insertion and deletion operation in simple queue. 07
OR
(c) Write an algorithm to delete an element from circular queue. Show the 07
steps of insertion and deletion operation in sample circular queue.

Q.3 (a) Describe the advantages of linked list over array. 03


(b) Write an algorithm to insert a node at last position in doubly linked list. 04
(c) Write an algorithm to print the singly linked list in reverse order using 07
stack.
OR
Q.3 (a) Describe following terms with respect to binary tree: 03
(1) depth of tree (2) balanced tree (3) complete tree
(b) Construct the binary tree for the following tree traversals. 04
Inorder: B F G H P R S T W Y Z
Preorder: P F B H G S R Y T W Z
(c) Write an algorithm to insert a node into binary search tree. 07

Q.4 (a) Prove that a binary tree with 20 nodes have 21 null branches. 03
(b) Write a recursive algorithm for preorder traversal of binary tree. 04
(c) Describe Prim’s minimum spanning tree algorithm with example. 07
OR
Q.4 (a) Show the resultant BST after applying following operations in sequence 03
on given tree. Delete 8 b) Insert 9 c) Delete 7

(b) Enlist and describe different ways for representing graph data structure 04
with example.
(c) Show the steps of BFS and DFS traversal for following graph starting 07
from vertex 2. Consider adjacency list is sorted in ascending order.
1
Q.5 (a) Write an algorithm for linear searching. 03
(b) Describe indexing structure for index file. 04
(c) Write an algorithm for merge sort. Show the steps of its working with 07
sample data.
OR
Q.5 (a) Define hash function. Describe any two hash methods with example. 03
(b) Write an algorithm for binary searching. 04
(c) Apply bubble sort on following data and show all steps. 07
123, 34, 65, 105, 27, 79, 12, 10, 125, 156

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III (New) EXAMINATION – WINTER 2019
Subject Code: 3130702 Date: 28/11/2019
Subject Name: Data Structures
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Marks
Q.1 (a) Discuss various types of data structures with 03
example.
(b) What is hash function used for? Give one example 04
of a hash function.
(c) What is time and space analysis? State and explain 07
time analysis for linear search and binary search
method.

Q.2 (a) Compare Array and Link list. 03


(b) State disadvantages of simple queue. How to 04
overcome it?
(c) Write an algorithm for INSERT, DELETE and 07
DISPLAY function of Circular Queue.
OR
(c) Write an algorithm for INSERT operation to insert 07
a node at a given position in a Link list.
Q.3 (a) Discuss height balance tree. 03
(b) Discuss Minimal Spanning Tree. 04
(c) Write a recursive function to compute factorial of 07
a number. Show usage of STACK in recursion for
this function.
OR
Q.3 (a) Write an algorithm to find length of a simple link 03
list.
(b) Write an algorithm to insert a node in a Circular 04
Link List at the FIRST position.
(c) Write an algorithm for DELETE operation in a 07
Binary search tree.
Q.4 (a) Discuss Threaded Binary Tree. 03
(b) Write an algorithm for a non recursive (Iterative) 04
pre order traversal of Binary search tree.
(c) Create an AVL tree for the following sequence of 07
numbers. Also mention name of action taken.
200, 400, 800, 900, 850, 700, 950, 100, 150
OR

Q.4 (a) Define following with respect to Tree: 03


i) M-ary tree ii) Out Degree iii) Leaf
(b) State at least one efficient representation of a 04
sparse matrix.
1
(c) Discuss algorithm of Breadth First Search (BFS) 07
traversal for a Graph. Explain with an example.
Q.5 (a) Write algorithm for Bubble sort method. 03
(b) Write algorithm for Merge sort method. 04
(c) Explain Sequential Files and Indexed Sequential 07
Files Structures
OR
Q.5 (a) Create 2-3 Tree for the following sequence: 03
50, 100, 150, 200
(b) Represent following in form of an expression tree: 04
A+B*(C+D)
(c) State and explain collision resolution techniques in 07
hashing.

****************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III EXAMINATION – SUMMER 2020
Subject Code: 3130702 Date:27/10/2020
Subject Name: Data Structures
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Marks

Q.1 (a) Differentiate between data types and data structures. 03


(b) Answer the followings: 04
(1) Give examples of Linear and Non-Linear
Data Structures.
(2) What do you mean by Abstract Data Types?

(c) Discuss and write a program to implement queue 07


functions using arrays.

Q.2 (a) Distinguish between stack and queue. 03


(b) What is top of stack? Why stack is called LIFO list? 04
(c) What is a circular queue? How do you check the 07
queue full condition? Write an algorithm to count
the nodes in a circular queue.
OR
(c) Explain creation, insertion and deletion of doubly 07
linked list with example.
Q.3 (a) What are binary trees? Mention different types of 03
binary trees with example.
(b) What is a graph? Explain various representations of 04
graphs.
(c) Write an algorithm to add a node into a binary 07
search tree.
OR
Q.3 (a) What is B -tree of order m? Draw a B-tree of order 03
3.
(b) Construct a binary tree having the following 04
traversal sequences:
Preorder traversal A B C D E F G H I
Inorder traversal B C A E D G H F I
(c) Discuss algorithm of Breadth First Search (BFS) 07
traversal for a Graph. Explain with an example.
Q.4 (a) Explain Sequential file organizations and list its 03
advantages and disadvantages.
(b) How access of record is performed in multi key file 04
organization?
1
(c) Describe various collision resolution techniques in 07
hashing.
OR
Q.4 (a) Explain indexed sequential file structure. 03
(b) Explain minimal spanning tree. 04
(c) What is hashing? What are the qualities of a good 07
hash function? Explain any two hash functions in
detail.
Q.5 (a) Define topological sort? 03
(b) Compare sequential searching with binary 04
searching in detail.
(c) Examine the algorithm for Insertion sort and sort the 07
following array: 77, 33, 44, 11, 88, 22, 66, 55
OR

Q.5 (a) What do you mean by internal and external sorting? 03


(b) Write an algorithm for quick sort. 04
(c) What is Binary Search Tree? Construct a binary 07
search tree for the following elements
21, 16, 24, 18, 22, 25, 26, 27, 29, 33

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–III (NEW) EXAMINATION – WINTER 2020
Subject Code:2130702 Date:10/03/2021
Subject Name:Data Structure
Time:10:30 AM TO 12:30 PM Total Marks:56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Q.1 (a) Explain time and space complexity of an algorithm. 03


(b) Explain primitive, non-primitive, linear and non-linear data structures. 04

(c) Define following terms: 07


(i) data structures (ii) recursion (iii) sparse matrix
(iv) degree of graph (v) minimum spanning tree
(vi) complete binary tree (vii) double ended queue

Q.2 (a) Evaluate following expression using stack. 03


623+-382/+*2$3+
(b) Convert the following expression into postfix form. 04
1. A ^ B * C - D + E / F / ( G + H )
2. ( A + B ^ C ^ D ) * ( E + F / D )
(c) Write a C program to implement stack using array with push, pop and 07
display functions.

Q.3 (a) Explain with example: circular queue 03


(b) Write and discuss applications of stack and queue. 04
(c) Write user defined C function to insert and delete a node at/from end in 07
doubly linked list.

Q.4 (a) Explain with example: priority queue 03


(b) Differentiate between array and linked list. 04
(c) Write user defined C function to insert and delete a node at/from specific 07
location in singly linked list.

Q.5 (a) Construct a binary tree from the traversals given below: 03
Inorder: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90
Preorder: 50, 10, 0, 40, 30, 20, 90, 80, 60, 70
(b) Write a short on height balanced and weight balance tree. 04
(c) Explain insertion operation in the 2-3 tree: (i) if the parent has 2 children 07
and (ii) if the parent has 3 children.

Q.6 (a) Construct a binary search tree from the traversals given below: 03
Inorder: 20, 30, 35, 40, 70, 80, 90, 100
Postorder: 20, 35, 30, 80, 70, 100, 90, 40
(b) Write a short on breadth first search and depth first search in graph. 04
(c) Explain AVL tree with example. 07

1
Q.7 (a) Explain binary search with example. 03
(b) Write a C program for bubble sort. 04
(c) Explain the techniques for collision-resolution in Hashing with example. 07

Q.8 (a) Explain sequential search with example. 03


(b) Write an algorithm for quick sort. 04
(c) Explain sequential files and indexed sequential files structures. 07

********************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–III (NEW) EXAMINATION – WINTER 2020
Subject Code:3130702 Date:10/03/2021
Subject Name:Data Structures
Time:10:30 AM TO 12:30 PM Total Marks:56
Instructions:
1. Attempt any FOUR questions out of EIGHT questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.

Marks
Q.1 (a) Compare array and linked list. 03
(b) Compare primitive and non primitive data types. datastructures 04
(c) Write an algorithm to perform insert and delete operations on simple queue. 07

Q.2 (a) Search the number 50 from the given data using binary search technique. 03
Illustrate the searching process.
10, 14, 20, 39, 41, 45, 49, 50, 60
(b) Apply merge sort algorithm to the following elements. 20, 10, 5, 15, 25, 30, 04
50, 35
(c) Write a ‘C’ program for bubble sort. 07

Q.3 (a) What is stack? Why do we use multiple stacks? 03


(b) Convert the following infix expressions to their prefix and postfix 04
equivalents.
1. A*B+C/D
2. (A*B)+(C/D)-(D+E)
(c) What is priority queue? Discuss its applications and implementation details. 07

Q.4 (a) Evaluate the following postfix expression using stack. 03


53+62/*35*+
(b) Design an algorithm to perform insert operation in circular queue. 04
(c) Design an algorithm to merge two linked list. 07

Q.5 (a) Define: 1. Acyclic graph 2. Leaf node 3. Complete binary tree 03
(b) For following expressions, construct the corresponding binary tree. 04
1. A+B/C*D-E
2. ((A+B)-(C*D))%((E^F)/(G-H))
(c) How are graphs represented inside a computer’s memory? Which method 07
do you prefer and why?

Q.6 (a) Define: 1. Connected graph 2. Threaded tree 3. Degree of node 03


(b) Differentiate between depth first search and breadth first search. 04
(c) Design an algorithm to insert a given value in the binary search tree. 07

Q.7 (a) Explain basic file operations. 03


(b) List out applications of hashing. 04
(c) What is file organization? Briefly summarize different file organizations. 07

1
Q.8 (a) Give a brief note on indexing. 03
(b) Build a chained hash table of 10 memory locations. Insert the keys 131, 3, 04
4, 21, 61, 24, 7, 97, 8, 9 in hash table using chaining. Use h(k) = k mod m.
(m=10)
(c) Consider the hash table of size 10. Using quadratic probing, insert the keys 07
72, 27, 36, 24, 63, 81, and 101 into hash table. Take c1=1 and c2=3.

**********************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (NEW) EXAMINATION – SUMMER 2021
Subject Code:3130702 Date:08/09/2021
Subject Name:Data Structures
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) Explain primitive and Non-primitive data types in detail. 03


(b) Explain Binary Search with example. 04
(c) Explain Asymptotic Notations in detail. 07
Q.2 (a) Differentiate: Static and Dynamic Memory Allocation 03
(b) Explain linear and Non-linear data structure with example. 04
(c) What is stack? Explain operations on stack in detail. 07
OR
(c) What is queue? Explain operations on queue in detail. 07
Q.3 (a) Explain advantages of circular queue over Simple queue. 03
(b) Explain Tower Of Hanoi with example. 04
(c) Write and explain algorithm for deletion in Singly Linked List. 07
OR
Q.3 (a) Evaluate the following postfix expression in tabular form: 3 5 * 6 2 / 03
+
(b) Explain Dequeue and Priority queue in detail. 04
(c) Write and Explain algorithm for insertion in doubly linked list. 07
Q.4 (a) Define the following: 03
1. Sibling
2. Forest
3. Strictly Binary Tree
(b) Construct BST for following sequence and find inorder traversal for 04
the same.
35, 46, 29, 2, 24 ,68, 44, 57, 1, 22, 79, 71
(c) Explain Prim’s algorithm with suitable example. 07
OR
Q.4 (a) Write an algorithm for selection sort. 03
(b) Differentitae: BFS and DFS. 04
(c) Explain Kruskal’s algorithm with suitable example. 07
Q.5 (a) Explain indexed file organization. 03
(b) Explain rotation rules for AVL tree. 04
(c) Explain insertion and deletion in B-tree with example. 07
OR
Q.5 (a) Explain random file organization. 03
(b) Explain collision resolution techniques with example. 04
(c) Construct AVL tree for following sequence: 07
10, 20, 30, 40, 50, 60, 70 ,80
*************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III (NEW) EXAMINATION – WINTER 2021
Subject Code:3130702 Date:19-02-2022
Subject Name:Data Structures
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) What is time complexity? Explain with example. 03


(b) Explain malloc and free functions in ‘C’. Also discuss advantages of 04
dynamic over static memory allocation.
(c) Explain following: 07
(i) priority queue (ii) primitive data structures (iii) non-primitive data
structures (iv) linear data structures (v) nonlinear data structures (vi)
applications of stack (vii) sparse matrix

Q.2 (a) Write an algorithm for infix to postfix conversion. 03


(b) Write an algorithm to evaluate postfix expression. Explain working of the 04
algorithm using appropriate example.
(c) Write a ‘C’ program to reverse a string using stack. 07
OR
(c) Write algorithm to (i) insert, and (ii) delete elements in circular queue. 07

Q.3 (a) Write user defined ‘C’ function to insert node at a specific location in singly 03
linked list.
(b) Write user defined ‘C’ function to delete node from end in circular linked 04
list.
(c) Write a ‘C’ program to implement queue using linked list. 07
OR
Q.3 (a) Write user defined ‘C’ function to insert node at the end in circular linked list. 03
(b) Write user defined ‘C’ function to delete node from a specific location in 04
doubly linked list.
(c) Write a ‘C’ program to implement stack using linked list. 07

Q.4 (a) Construct a binary tree from the traversals given below: 03
Inorder: D, B, A, E, G, C, H, F, I
Preorder: A, B, D, C, E, G, F, H, I
(b) Write a short on AVL tree. 04
(c) Explain the concept of B-tree with suitable example and list its applications. 07
OR
Q.4 (a) Construct a binary search tree from the following numbers. 03
38, 13, 51, 10, 12, 40, 84, 25, 89, 37, 66, 95
(b) Explain BFS and DFS. 04
(c) Explain B+ tree with example. 07

Q.5 (a) Explain Prim’s algorithm. 03


(b) Write a ‘C’ program for selection sort. 04
(c) List out different hash methods and explain any three. 07
1
OR
Q.5 (a) Define terms with respect to file: fields, records, database 03
(b) Compare sequential and binary search methods. 04
(c) Apply quick sort for the following data: 07
9, 7, 5, 11, 12, 2, 14, 3, 10, 6

**********

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III (NEW) EXAMINATION – SUMMER 2022
Subject Code:3130702 Date:13-07-2022
Subject Name:Data Structures
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
MARKS
Q.1 (a) What do you mean by time and space complexity of an algorithm? 03
(b) Explain types of data structures with examples 04
(c) Write and explain algorithms for PUSH and POP operations on stack 07
data structure.

Q.2 (a) Write applications of stack and queue data structures, 03


(b) Evaluate the following postfix expression and show the stack trace. 04
651–4*23^/+
(c) Convert the following infix expressions to postfix expressions and show 07
the stack trace.
(i) (A+B)*C+D / (E+F*G) + H
(ii) ((A/(B-C+D))*(E-F)*G)
OR
(c) Convert the following infix expressions to prefix expressions and show 07
the stack trace.
(i) A*(B+C)/D-E*F^G
(ii) A+B*(C-D/E$F)*G

Q.3 (a) Explain the working of priority queue with suitable example. 03
(b) Write an algorithm for insertion of a new node at last position in Singly 04
Linked List.
(c) Write a C program to implement simple queue and check for boundary 07
conditions.
OR
Q.3 (a) List the advantages of doubly linked list over singly linked list. 03
(b) Write an algorithm for deletion of a specific node from the Singly 04
Linked List.
(c) Write a C program to implement circular queue with insertion and 07
deletion operations.

Q.4 (a) How can you represent a Binary Tree in memory using array? 03
(b) Given Inorder and Preorder traversal, find Postorder traversal. Inorder: 04
YBKCFAGXEDHZ
Preorder: G B Y A C K F X D E Z H
(c) What is a binary search tree? Create a binary search tree for the 07
following data. 14, 10, 17, 12, 10, 11, 20, 12, 18, 25, 20, 8, 22, 11, 23
Explain deleting node 20 in the resultant binary search tree.
OR
Q.4 (a) Write algorithms for the inorder, preorder and postorder traversal of the 03
binary tree.

1
(b) Draw a Binary expression tree for the following and perform preorder 04
traversal: a * ( b + c ) + ( d * e ) / f + g * h
(c) Insert the following letters into an empty B-tree of order 5: C N G A H 07
EKQMFWLTZDPRXYS

Q.5 (a) Define the following terms 03


(a) Complete binary tree (b) Leaf node (c) Height of a tree.
(b) Write an algorithm for insertion sort. 04
(c) Initially the following keys 10,16,11,1,3,4,23 and 15 are inserted into an 07
empty hash table of length 10. Using open addressing with hash function
h(k)=k mod 10 and a linear probing. What is the resultant hash table?
OR
Q.5 (a) Define the following terms 03
(a) Directed graph (b) Multigraph (c) Complete graph.
(b) Write an algorithm for selection sort. 04
(c) What is collision? What are the methods to resolve collision? Explain 07
any one method to resolve collision with example.

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– III(NEW) EXAMINATION – WINTER 2022
Subject Code:3130702 Date:22-02-2023
Subject Name:Data Structures
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) Differentiate primitive and non-primitive data structures 03


(b) Define time complexity? Explain worst case and best case complexity with 04
examples.
(c) Convert following infix expression into postfix expression using stack. 07
(A-B)/C*D^(E/F)^(G+H)

Q.2 (a) What is Sparse matrix? Write efficient vector representation of following 03
Sparse matrix.
1 0 0
0 2 0
0 0 3
(b) What is the worst case complexity of binary search? Write an algorithm for 04
binary search.
(c) Create Binary Search Tree for following Data and write pre-order traversal, in- 07
order traversal and post-order traversal of the constructed tree.
10 15 28 09 39 31 30 14 07 08
OR
(c) Create AVL tree for following Data and write pre-order traversal of the 07
constructed tree.
10 15 28 09 39 31 30 14 07 08
Q.3 (a) Write c program for bubble sort. 03
(b) Write algorithm to insert into simple queue and mention the limitation of 04
simple queue?
(c) Find the minimum spanning tree of following graph using Kruskal’s method. 07

OR
1
Q.3 (a) Write c program for selection sort. 03
(b) Write algorithm to delete from circular queue and mention the advantage of 04
circular queue over simple queue?
(c) Find the minimum spanning tree of the following graph using prim’s method. 07

Q.4 (a) What is priority queue? Is simple queue is anyhow priority queue? Explain 03
your answer.
(b) Write C program to find the Fibonacci sequence of n terms using recursion. 04
(c) Explain DFS and BFS with appropriate example. 07
OR
Q.4 (a) What is linked list? States the advantages of linked list over array. Also list 03
various types of the linked list.
(b) Write recursive solution for tower of Hanoi. How many moves require for 04
transferring three discs?
(c) Explain Dijkstra’s shortest path algorithm with appropriate example 07

Q.5 (a) Define following terms 03


1) Balance factor
2) Hash function
3) Cyclic graph
(b) Sort following data using merge sort. 04
10 15 28 09 39 31 30 14 07 08
(c) Define hash collision? Explain collision various resolution techniques. 07
OR
Q.5 (a) Define following terms 03
1) Hash table
2) Graph
3) Complete binary tree
(b) Sort following data using quick sort. 04
10 15 28 09 39 31 30 14 07 08
(c) What is file? Explain various types of file organization. 07

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–III(NEW) EXAMINATION – SUMMER 2023
Subject Code:3130702 Date:26-07-2023
Subject Name:Data Structures
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) What is DS? Explain data structure and its types. 03
(b) Explain Tower of Hanoi with example. 04
(c) Write algorithms to insert, and delete elements in queue 07

Q.2 (a) Construct Binary Tree where the preorder traversal is 1,2,4,5,3,6,8,9,7 & 03
postorder is 4,5,2,8,9,6,7,3,1.
(b) Construct an AVL Tree by inserting numbers from 1 to 8. 04
(c) What is stack? Explain operations on stack in detail. 07
OR
(c) Explain tree traversal in detail with example. 07

Q.3 (a) Explain 2-3 Tree in brief. 03


(b) Explain any three hashing techniques with example. 04
(c) What is problem with simple queue? Explain its solution with example and 07
algorithms.
OR
Q.3 (a) Explain binary search technique. 03
(b) Explain fastest sorting technique with example. 04
(c) What is collision? Explain collision resolution techniques with example. 07

Q.4 (a) List all asymptotic notations and explain any one of it. 03
(b) List and explain linked list applications. 04
(c) What is doubly linked list? Write Algorithm for insertion and deletion in 07
doubly linked list.
OR
Q.4 (a) What is file? Explain types of files. 03
(b) Convert the following infix expressions to their prefix. 04
(A^B*C-D+E/F/(G+H))
(c) Explain Prim’s & Kruskal’s algorithm with suitable example 07

Q.5 (a) Explain malloc and free functions in ‘C’. 03


(b) Define the following: 1. Sibling 2. Forest 3. Complete Binary Tree 4. 04
Complete Graph
(c) Explain following: (i) Recursion (ii) Nonprimitive data structures (iii) 07
Hashing (iv) Non- linear data structures (v) sparse matrix (vi) Priority queue
(vii) Collision
OR
Q.5 (a) What is time complexity? Explain with example. 03
(b) Explain Binary Search with example. 04
(c) Write and explain algorithm for insertion in Singly Linked List 07

You might also like