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

C 5 Islib FOUZSQK0 J

This document outlines the mid-semester examination for B Tech 3rd Semester students at Dr B R Ambedkar National Institute of Technology, Jalandhar, focusing on Data Structures and Algorithms. It includes details on the exam duration, maximum marks, and a breakdown of questions aligned with course outcomes. The questions cover various topics such as linked lists, arrays, stacks, pseudocode for algorithms, and time complexity analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

C 5 Islib FOUZSQK0 J

This document outlines the mid-semester examination for B Tech 3rd Semester students at Dr B R Ambedkar National Institute of Technology, Jalandhar, focusing on Data Structures and Algorithms. It includes details on the exam duration, maximum marks, and a breakdown of questions aligned with course outcomes. The questions cover various topics such as linked lists, arrays, stacks, pseudocode for algorithms, and time complexity analysis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Roll No…………………..

Dr B R Ambedkar National Institute of Technology, Jalandhar


B Tech 3rd Semester (CSE & DSE)
CSDC0201, Data Structures and Algorithms
Mid-Semester Examination, October-2024
Duration: 02 Hours Max. Marks: 30 Date: 4 October 2024

Marks Distribution & Mapping of Questions with Course Outcomes (COs)


Question Number 1 2 3 4 5 6
Max. Marks 6 5 6 5 5 3
CO No. 1,2 1,2 1 1 2 1
*Cognitive Level U Ap C C C An
**Section/Chapter/Unit - - - - - -
1. Explain the following with proper examples: (1.5*4)
a. Mention two real-life applications of Circular Linked list.
b. Mention the scenarios where you can use (i) linked list over array (ii)
array over linked list.
c. How are the arrays used to represent the sparse matrix?
d. How back substitution method is different from recursion tree?
Compare and contrast both methods along with their limitations.
2. (2+1+2)
a. Consider an array A[50][30] is stored according to row major order
with each of its elements occupying 4 bytes. Find out the base address
and the address of an element A[15][25], if the location A[15][20] is
stored at the address 8000.
b. Consider the following code:
int array[5]={1,2,3,4,5};
int a= array[array[array[1]]];
Find the value of variable a in this case.
c. Explain how you would use a stack to reverse a string.
3. (3*2)
a. The following C function (given at page number 2) takes a single-
linked list of characters as a parameter and rearranges the elements of
the list. The function is called with the list containing the characters:
‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’ in the given order. What will be the
contents of the list after the function completes execution?
b. Concatenate two circular linked lists, L1 and L2, and name the
resulting list L3. Remove all prime numbers from L3. Insert the next
composite number (following the removed prime number) into the list
and name the final list L4.

1
4. Write the pseudocode for the following problem: The stock span problem is
a financial problem where we have a series of N daily price quotes for a stock
and we need to calculate the span of the stock’s price for all N days. The
span Si of the stock’s price on a given day i is defined as the maximum
number of consecutive days just before the given day, for which the price of
the stock on the current day is less than or equal to its price on the given day.
Examples:
Input: N = 7, price[] = [100 80 60 70 60 75 85]
Output: 1 1 1 2 1 4 6
Explanation: Traversing the given input span for 100 will be 1, 80 is smaller
than 100 so the span is 1, 60 is smaller than 80 so the span is 1, 70 is greater
than 60 so the span is 2 and so on. Hence the output will be 1 1 1 2 1 4 6.
Input: N = 6, price[] = [10 4 5 90 120 80]
Output:1 1 2 4 5 1
Explanation: Traversing the given input span for 10 will be 1, 4 is smaller
than 10 so the span will be 1, 5 is greater than 4 so the span will be 2 and so
on. Hence, the output will be 1 1 2 4 5 1.
5. Your best friend has a very interesting necklace with n pearls. On each of the
pearls of the necklace there is an integer. However, your friend wants to
modify the necklace a bit and asks you for help. She wants to move the first
pearl k spots to the left (and do so with all other pearls). Help your best friend
determine how the necklace will look after the modification.
6. Calculate the time complexity of following functions using any method:
i. T(n) = T(n/2)+T(n/4)+T(n/8)+n

You might also like