English

Using linear search determine the position of 8, 1, 99 and 44 in the list: [1, -2, 32, 8, 17, 19, 42, 13, 0, 44] Draw a detailed table showing the values of the variables

Advertisements
Advertisements

Question

Using linear search determine the position of 8, 1, 99 and 44 in the list:

[1, -2, 32, 8, 17, 19, 42, 13, 0, 44]

Draw a detailed table showing the values of the variables and the decisions taken in each pass of linear search.

Short/Brief Note
Advertisements

Solution

Element 8 is found at position 4 after 4 comparisons.

Element 1 is found at position 1 after 1 comparisons.

Element 99 is not found in the list.

Element 44 is found at position 10.

shaalaa.com
Linear Search in Python
  Is there an error in this question or solution?
Chapter 6: Searching - Exercise [Page 94]

APPEARS IN

NCERT Computer Science [English] Class 12
Chapter 6 Searching
Exercise | Q 1. | Page 94
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×