English

How is linear search different from binary search?

Advertisements
Advertisements

Question

How is linear search different from binary search?

Distinguish Between
Advertisements

Solution

Basis of Difference Linear Search Binary Search
Method Checks elements one by one from the beginning. Checks the middle element and repeatedly halves the search range.
Requirement Works on sorted as well as unsorted lists. Requires the list to be sorted.
Speed Slower for large lists. Faster for large sorted lists.
Comparisons May compare every element. Makes far fewer comparisons by eliminating half the list at each step.
Best use Small or unsorted lists. Large sorted lists.
shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Liner List Manipulation - EXERCISE [Page 104]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 5 Liner List Manipulation
EXERCISE | Q 8. | Page 104
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×