Data Structures and Algorithms - Performance Analysis of Algorithms and Recurrences

Avatto > > UGC NET COMPUTER SCIENCE > > PRACTICE QUESTIONS > > Data Structures and Algorithms > > Performance Analysis of Algorithms and Recurrences

126. Given below are some algorithms, and some algorithm design paradigms.

List-IList-II
A.Dijkstra's Shortest PathDijkstra's Shortest Path1.Divide and Conquer
B.Floyd-Warshall algorithm to compute all
pairs shortest path
2.Dynamic Programming
C.Binary search on a sorted array3.Greedy design
D.Backtracking search on a graph4.Depth-first search
  5.Breadth-first search
 Match the above algorithms (List-I) to the corresponding design paradigm (List-II) they follow.
Codes:
 ABCD
(a)1315
(b)3315
(c)3214
(d)3215

  • Option : C
  • Explanation :
    Dijkstr a use greedy approach, warshals use dynamic programming approach, Binary search is based on divide and conquer and Backtracking is depth first search.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


127. The average number of key comparisons done on a successful sequential search in list of length n is

  • Option : D
  • Explanation :
    Suppose we want to search y.
    No of comparision
    = 1× Probability of 1st element being x
    + 2 * Probability of 2nd element being x.
    + 3* Probability of 3rd element being x.
    + n* Probability of nth element being x.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *