The document outlines the Mid Semester Examination for the Data Structures & Algorithms course at Thapar Institute, detailing the exam date, duration, marks, and faculty involved. It includes four questions covering algorithm comparisons, sorting methods, linked list operations, and memory address calculations. Students are required to attempt all questions, demonstrating their understanding of key concepts in data structures and algorithms.
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 ratings0% found this document useful (0 votes)
10 views1 page
UCS613
The document outlines the Mid Semester Examination for the Data Structures & Algorithms course at Thapar Institute, detailing the exam date, duration, marks, and faculty involved. It includes four questions covering algorithm comparisons, sorting methods, linked list operations, and memory address calculations. Students are required to attempt all questions, demonstrating their understanding of key concepts in data structures and algorithms.
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/ 1
Roll Number:
Thapar Institute of Engineering and Technology, Patiala
Mid SEMESTER EXAMINATION Semester-IV/VI Course Code: UCS613 Course Name: Data Structures & Algorithms Date: March 11, 2023 Saturday, 10:30 am — 12:30 pm Time: 2 Hours, M. Marks: 40 Name of Faculty: AS, SJ, RU, VK Note: Attempt all questions. Ql. [Marks 10] Algorithm A and B spend exactly TA(n) = 0.1n2 logio n and TB (n) = 2.5n2 microseconds, respectively, for a problem of size n. Choose the algorithm, which is better in the Big- Oh sense, and find out a problem size no such that for any larger size n > no the chosen algorithm outperforms the other. If your problems are of the size n 5_ 109, which algorithm will you recommend to use? Q2. [Marks 4+4+2] On the given number sequence {90,80,40,70,60,20,30}, perform the following operations: a. Perform Insertion Sort method to arrange the numbers in ascending order. Write each step of the operation with graphical representation using array. b. Write the C++ code exhibiting three functions: Print function, Insertion Sort function, and main function. c. What is the worst and average case time complexity of the Insertion sort? Q3. [Marks 2+4+2+2] Create a node for doubly linked list and circular linked list. Show the insertion of an element at the end of the both lists, either by code or by algorithm. Also mention the advantages and applications of both types of linked lists? Q4. (i) [4 Marks] Consider a 2-D array A[-5.....20] [20....70]. The base address of array in memory is 1020. Size of each element is 8 bytes. Find the location of A[0][30] in both column major order & row major order. (ii) [5 Marks] What is the output printed by the following program? #include<stdio.h> int f(int n, int k) 1 if(n==0) return 0; else if(n%2) return f(n/2, 2*k)+k; else return f(n/2, 2*k)-k; 1 int main() 1 printf("%d",f(20,1)); return 0; } (iii) [1 Marks] Consider a standard Circular Queue 'q' implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q[0], q[1], q[2] ,q[ 1 0]. The front and rear pointers are initialized to point at q[2]. Identify the position, at which the ninth element will be added?