0% found this document useful (0 votes)
276 views5 pages

DAA Quiz Answers

The document contains a 10 question quiz about algorithms and data structures. It asks about the time complexity of an algorithm, the origin of the word "algorithm", definitions of key terms like algorithm and pseudocode, analysis of sorting algorithms like merge sort, quicksort, and heapsort, and recurrence relations.

Uploaded by

Hrithik Gupta
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)
276 views5 pages

DAA Quiz Answers

The document contains a 10 question quiz about algorithms and data structures. It asks about the time complexity of an algorithm, the origin of the word "algorithm", definitions of key terms like algorithm and pseudocode, analysis of sorting algorithms like merge sort, quicksort, and heapsort, and recurrence relations.

Uploaded by

Hrithik Gupta
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/ 5

SEPTEMBER 2

Galgotias University
Authored by: Hrithik Gupta
Quiz answers of :-
Design and analysis of Algorithm

1
Quiz Questions & Answers :-

1.    What is the time complexity of fun()?


int fun(int n)

  int count = 0;

  for (int i = 0; i < n; i++)

     for (int j = i; j > 0; j--)

        count = count + 1;

  return count;

   

A.

Theta (n)

B.

Theta (n^2)

C.

Theta (n log n)

2
D.  None

2.   The word ____________comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Kh

A.  Algorithm

B.  Flowchart

C.  Syntax

D.  None
3.   In computer science, algorithm refers to a special method usable by a computer for the solution to a problem.   

A.  True

B.  False
4.   When an algorithm is written in the form of a programming language, it becomes a _________   

A.  Program

B.  Syantax

C.  Flow Chart

D.  Psudo code
5.   Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either m
28 How many heapify operations have been performed on root of heap?   

A.  1

B.  2

C.  3 or 4

D.  5
6.   Which of the following is true about merge sort?   

A.  Merge Sort works better than quick sort if data is accessed from slow sequential memory.

3
B.

Merge Sort is stable sort by nature

C.  Merge sort outperforms heap sort in most of the practical situations.

D.

All of the above.

7.   Which of the following sorting algorithms has the lowest worst-case complexity?   

A.  Merge Sort

B.  Quick Sort

C.  Bubble Sort

D.  Selection Sort
8.   What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using

A.  n

B.  n log n

C.  n^2

D.  None
9.   A ______________ is diagram that depicts the flow of a program.   

A.  Algorithm

B.  hash table

C.  graph

D.  flow chart
10.   What is recurrence for worst case of QuickSort and what is the time complexity in Worst case?   

4
A.

Recurrence is T(n) = T(n-2) + O(n) and time complexity is O(n^2)

B.

Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)

C.  Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nLogn)

D.

Recurrence is T(n) = T(n/10) + T(9n/10) + O(n) and time complexity is O(nLogn)

You might also like