✏️ Explanatory Question

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

👁 132 Views
📘 Detailed Answer
🟢 Easy
💡

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.