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

African University of Science and Technology, Abuja Department of Computer Science

This document contains a set of questions related to data structures and algorithms. It includes multiple choice and long answer questions testing knowledge of topics like time complexity analysis, sorting algorithms, arrays, and asymptotic notations. It contains two sections - the first with 7 multiple choice questions and the second asking to attempt 4 out of 5 long answer/programming questions on related topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views2 pages

African University of Science and Technology, Abuja Department of Computer Science

This document contains a set of questions related to data structures and algorithms. It includes multiple choice and long answer questions testing knowledge of topics like time complexity analysis, sorting algorithms, arrays, and asymptotic notations. It contains two sections - the first with 7 multiple choice questions and the second asking to attempt 4 out of 5 long answer/programming questions on related topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

African University of Science and Technology, Abuja

Department of Computer Science


Data Structures and Algorithm (CSC-816)
Question Set-1
Attempt all the parts:
1. What will be values of i and j after executing the following code?
int i=1, j;
j = i++ * ++i * i++;
(a) i=4, j=8 (b) i=4, j=2 (c) i=3, j=2 (d) None
2. What will be values of i, j and k after executing the following code?
int i=1, j;
j = i++;
k= i++ + j++;
(a) i=3, j=2, k=3 (b) i=3, j=1, k=3 (c) i=2, j=2, k=2 (d) None
3. How many times, the body of following loop is executed?
int i=0;
while (i<3)
{
i = i+ ¾;
}
(a) 3 (b) 4 (c) 2 (d) infinite
4. What will be the value of x in the following program segment?
int i=0, x=1;
for(i=0; i<5; i++);
x+=i;
(a) 6 (b) 11 (c) 12 (d) None
5. Running time of the recurrence T(n) = T(n/2) + 1 is:
(a) O(n) (b) (log2 n) (c) 10 (d) None
6. In the best case, which of the following sorting method is best applicable?
(a) Bubble (b) Merge (c) Quick (d) All
7. Which of the notation describes worst case time analysis?
(a)  (b)  (c)  (d) O and  both

Section B

Attempt any four parts:


1. Answer the following:
a. Define an array. What is the difference between 1-dimensional and 2-dimensional
arrays? Explain with an example.
b. Define asymptotic notations.
2. Explain why, binary search is better than linear search in the average and worst case?
Write an algorithm / program for binary search. Search x=25 in the array: 1, 4, 6, 20, 22,
25, 30 36, 40, using binary search. Clearly indicate all the steps.
3. Write an algorithm / program for merge sort algorithm. Draw a recursion tree for the
following set of data: 4, 1, 5, 3, 2, 9, 0. Analyze its time complexity also.
4. Write an algorithm / program for quick sort algorithm. Find the output after first call of
partition on the data set: 4, 1, 5, 3, 2, 9, 0, -1, -3
5. How can you pass an array as arguments to a method? Hence or otherwise, write a
program to implement insertion sort in Python.

You might also like