मराठी

How many comparisons of Linear search will be required to search for key = 17 in the list [8,-4,7,17,0,12,56]? -

Advertisements
Advertisements

प्रश्न

How many comparisons of Linear search will be required to search for key = 17 in the list [8,-4,7,17,0,12,56]?

पर्याय

  • 4

  • 7

  • 8

  • 5

MCQ

उत्तर

4

Explanation:

List [8, -4, 7, 17, 0, 12, 56] has 7 elements, and the Linear search method compares the key to each member in the list one by one. Because key '17' is at index 3, which is the fourth position in the list, a match would be found in four comparisons. As a result, the answer is 4.

shaalaa.com
Linear Search
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×