हिंदी

Estimate the number of key comparisons required in binary search and linear search if we need to find the details of a person in a sorted database having 230 (1,073, 741, 824) records when details - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Estimate the number of key comparisons required in binary search and linear search if we need to find the details of a person in a sorted database having 230 (1,073, 741, 824) records when details of the person being searched lie at the middle position in the database. What do you interpret from your findings?

टिप्पणी लिखिए

उत्तर

If the record is in the middle of the sorted database, it will take one key comparison for binary search. As linear search is sequential that will take 115 keys comparison. Interpretation:

  • The linear search method is useful for collecting items that are small in size and are not in any particular order.
  • Binary search is a quick searching technique for large datasets which is in ascending or descending order.
shaalaa.com
Binary Search
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Searching - Exercise [पृष्ठ ९६]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
अध्याय 6 Searching
Exercise | Q 7. | पृष्ठ ९६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×