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

22TP201 1

The document provides instructions for a data structures examination, including 4 questions in Section A worth 40 marks total and 2 questions in Section B worth 40 marks total. Question 1 asks students to design and implement a jump search algorithm. Question 2 asks students to construct a stack and queue for a given string and show the results of pop/dequeue operations. Question 3 asks students to construct binary search trees and height-balanced binary search trees for a given data set. Question 4 asks students to print the reverse order of vertices from a breadth-first search of a given graph.

Uploaded by

julieakshaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

22TP201 1

The document provides instructions for a data structures examination, including 4 questions in Section A worth 40 marks total and 2 questions in Section B worth 40 marks total. Question 1 asks students to design and implement a jump search algorithm. Question 2 asks students to construct a stack and queue for a given string and show the results of pop/dequeue operations. Question 3 asks students to construct binary search trees and height-balanced binary search trees for a given data set. Question 4 asks students to print the reverse order of vertices from a breadth-first search of a given graph.

Uploaded by

julieakshaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Regulation: R22 Code No: 22TP201/1

II B. Tech. I Semester Regular Examinations – January, 2023


DATA STRUCTURES
(BI/BIO-TECH/BME/CHEM/CIVIL/CSE/CSE(CS)/ECE/EEE/FT/TT/MECH/R&A/TT)
Time: 150 Min Max. Marks: 80M
SECTION – A
Answer all Four questions 4×10M=40M

1. Like Binary Search, Jump Search is a searching algorithm for sorted arrays. The basic
idea is to check fewer elements (than linear search) by jumping ahead by fixed steps
or skipping some elements in place of searching all elements.
For example, suppose we have an array arr[] of size n and a block (to be jumped) of size
m.
Then we search in the indexes arr[0], arr[m], arr[2m]…..arr[km] and so on. Once we
find the interval (arr[km] < x <arr[(k+1)m]), we perform a linear search operation
from the index km to find the element x.
Design and implement the jump search algorithm.
Input: 2, 5, 7, 8, 10, 12.
Key: 10

2. Given the following sequence of letters and asterisks in the string stored in an array:
EAS*Y*QUE***ST***IO*N***.
(a) Construct a stack by performing the following operations for the string given
above and show the sequence of characters returned by the pop operations after reading
the complete string stored in the array.
(i) Perform the push operations when you come across any letter (for example
‘E’, ‘A’,…,etc.)
(ii) Perform the pop operation when you come across the character
asterisks (‘*’).
(b) Construct a queue by performing the following operations for the string given
and show the sequence of characters returned by the dequeue operations after reading
above the complete string stored in the array.
(i) Perform the enqueue operations when you come across any letter (for
example ‘E’, ‘A’,…,. )
(ii) Perform the dequeue operation when you come across the character
asterisks (‘*’).

1 of 2
Regulation: R22 Code: 22TP201/1

3. a) For the given set of data, construct a Binary Search tree and Height Balanced Binary
Search Tree.

J, R, D, G, T, E, M, H, P, A, F, Q

b) Design an algorithm constructs a BST.

4. Consider the graph G on six vertices {A, B, C, D, E, F} given by the following adjacency
list. Design an algorithm to print the reverse order of the vertices encountered on a
breadth- first search (BFS) of G starting from vertex A.
A : B(4), F(2) ( i.e. A is connected to B with weight 4 and F with weight 2)
B : A(l), C(3), D(4)
C : A(6), B(3), D(7)
D : A(6), E(2)
E : D(5)
F : D(2), E(3)

SECTION-B
Answer all Two questions 2×20M=40M
5. Design an algorithm and implement the following functions by taking an array as input from
user in ascending order. Input: 1 2 3 4 5 6 7 8 9 10
a) Taking pivot element as Starting index and perform quick sort..
b) Taking pivot element as Last index and perform quick sort.
c) Taking pivot element as median and perform quick sort.
d) Differentiate between merge sort and quick sort.
6. Construct a Binary Tree by using the array given below. Where index 0 represents the root
node and value -1 indicates null. Design an algorithm to construct the binary tree and
perform the following operations:
a) Print the Post Order traversal of the tree.
b) Print the level order traversal of the tree.
c) Print the right and left view of the tree.
Input:
Total number of keys: 15
1 2 3 4 5 6 7 -1 -1 -1 8 -1 -1 -1 9

2 of 2

You might also like