0% found this document useful (0 votes)
11 views2 pages

Data Structures Mid Sem QP

Kindly check

Uploaded by

sunnymanuka0
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)
11 views2 pages

Data Structures Mid Sem QP

Kindly check

Uploaded by

sunnymanuka0
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

(EC-2 Regular)

Question 1 [4 Marks]

(i) Define Big-Theta notation.


(ii) Compute running time of an algorithm?
ALGORITHM MatrixMultiplication(A[0..n − 1, 0..n − 1], B[0..n − 1, 0..n − 1])
//Multiplies two square matrices of order n by the definition-based algorithm
//Input: Two n × n matrices A and B
//Output: Matrix C = AB
for i ←0 to n − 1 do
for j ←0 to n − 1 do
C[i, j ]←0.0

C[i, j ]←C[i, j ]+ A[i, k] ∗ B[k, j]


for k←0 to n − 1 do

return C

Question 2 [4 Marks]

Write an algorithm to delete data from start to end positions in a Doubly Linked List (DLL) that
contains 10 data where start and end positions are not 1 and 10.

Example:
Let us assume that there are 10 data as
1 2 3 4 5 6 7 8 9 10

If the start and end positions are 2 and 6, the resultant list contains
1 7 8 9 10

Question 3 [6 Marks]

(i) Convert the expression A-(B/C+(D%E*F)/G)*H to prefix form with and without using stack.
(ii) Evaluate the given postfix expression 9 3 4 * 8 + 4 / -

Question 4 [6 Marks]

There are 'N' numbers of balls in the box. The colours of the balls are red and blue. You are requested to
stack the balls in the bottom sealed basket one by one. The order of placing the balls is two consecutive
red balls, followed by the two consecutive blue balls. Later, Create two empty queues Q1 and Q2.
Remove the last inserted ball from the basket and place it in Q1. Similarly remove the next ball from the
basket and insert in Q2. Develop a C program to repeat this process until the basket is empty and also
print the colour of the balls in both queues.

Question 5 [6 Marks]

35, 33, 42, 10, 14, 19, 26


(i) Trace the given numbers using Bubble Sort.
(ii) Write a routine and the time complexity.

Question 6 [4 Marks]

Construct a binary tree to satisfy the following orders:


Preorder : F B A D C E G I H K J and
Post-Order : A C E D B H K I J G F.

===All the best====

You might also like