Home / Questions / Write one difference between Linear Search and Binary Search. Java Language
Explanatory Question

Write one difference between Linear Search and Binary Search. Java Language

👁 132 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Difference between Linear Search and Binary Search:

  • Linear Search:
    Searches each element of the list one by one sequentially until the target is found. It works on both sorted and unsorted lists.

  • Binary Search:
    Searches by repeatedly dividing the sorted list in half and comparing the target with the middle element. It works only on sorted lists and is more efficient than linear search.