YOUR SUBJECT CS502 Fundamentals of AlgorithmsChange subject ↗
PRACTICE AT YOUR OWN PACE

CS502 practice questions

Think through the options before revealing the answer. Use the term filter to focus your revision.

260 questions
CS502 · Final-term only#140

Sorting is one of the few problems where provable ________ bonds exits on how fast we can sort,

  1. A
    ?upper
  2. B
    ?lower (Page 39)
  3. C
    ?average
  4. D
    ?log n
Show correct answer

Correct answer: B. ?lower (Page 39)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#139

The analysis of Selection algorithm shows the total running time is indeed ________in n,

  1. A
    ?arithmetic
  2. B
    ?geometric
  3. C
    ?linear (Page 37)
  4. D
    ?orthogonal
Show correct answer

Correct answer: C. ?linear (Page 37)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#138

Counting sort has time complexity:

  1. A
    ?O(n) Click here for detail
  2. B
    ?O(n+k)
  3. C
    ?O(k)
  4. D
    ?O(nlogn)
Show correct answer

Correct answer: A. ?O(n) Click here for detail

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#137

How much time merge sort takes for an array of numbers?

  1. A
    ?T(n^2)
  2. B
    ?T(n) (Page 40)
  3. C
    ?T( log n)
  4. D
    ?T(n log n)
Show correct answer

Correct answer: B. ?T(n) (Page 40)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#136

In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the
convergent _______________ series in the analysis,

  1. A
    ?linear
  2. B
    ?arithmetic
  3. C
    ?geometric (page 37)
  4. D
    ?exponent
Show correct answer

Correct answer: C. ?geometric (page 37)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#135

Which may be stable sort:

  1. A
    ?Bubble sort
  2. B
    ?Insertion sort
  3. C
    ?Both of above (page 54)
  4. D
    ?Selection sort
Show correct answer

Correct answer: C. ?Both of above (page 54)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#134

Dijkstra’s algorithm :

  1. A
    ?Has greedy approach to find all shortest paths
  2. B
    ?Has both greedy and Dynamic approach to find all shortest paths
  3. C
    ?Has greedy approach to compute single source shortest paths to all other vertices (Page 154)

  4. D
    ?Has both greedy and dynamic approach to compute single source shortest paths to all other vertices.
Show correct answer

Correct answer: C. ?Has greedy approach to compute single source shortest paths to all other vertices (Page 154)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#133

Quick sort is based on divide and conquer paradigm; we divide the problem on base of pivot element and:

  1. A
    ?There is explicit combine process as well to conquer the solution.
  2. B
    ?No work is needed to combine the sub-arrays, the array is already sorted
  3. C
    ?Merging the sub arrays
  4. D
    ?None of above. (Page 51)
Show correct answer

Correct answer: D. ?None of above. (Page 51)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#132

In Quick sort algorithm, constants hidden in T(n lg n) are

  1. A
    ?Large
  2. B
    ?Medium
  3. C
    ?Not known
  4. D
    ?Small
Show correct answer

Correct answer: D. ?Small

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#131

Which sorting algorithm is faster :

  1. A
    ?O(n^2)
  2. B
    ?O(nlogn) (Page 46)
  3. C
    ?O(n+k)
  4. D
    ?O(n^3)
Show correct answer

Correct answer: B. ?O(nlogn) (Page 46)

Check community answers against your course notes.Question permalink ↗