0% found this document useful (0 votes)
16 views11 pages

Linear Search and Binary Search

This document presents a comparison between Linear Search and Binary Search algorithms, detailing their methodologies, advantages, disadvantages, and applications in data retrieval. Linear Search is simple and works on unsorted data but is inefficient for large datasets, while Binary Search is faster for sorted data but requires more complex implementation. The conclusion emphasizes choosing the appropriate search method based on data size, order, and search frequency.

Uploaded by

Anay Radams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

Linear Search and Binary Search

This document presents a comparison between Linear Search and Binary Search algorithms, detailing their methodologies, advantages, disadvantages, and applications in data retrieval. Linear Search is simple and works on unsorted data but is inefficient for large datasets, while Binary Search is faster for sorted data but requires more complex implementation. The conclusion emphasizes choosing the appropriate search method based on data size, order, and search frequency.

Uploaded by

Anay Radams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

LINEAR SEARCH AND

BINARY SEARCH

MEMBERS

• SIMANTA ROY : DC2024BTE0195


• ANAY PAYUN : DC2024BTE0200
• BADAPHUNKI KHARSATI : DC2024BTE0149
Linear Search and Binary
Search
This presentation compares two fundamental searching algorithms:
Linear Search and Binary Search. We explore their working
principles, advantages, disadvantages, and practical applications
for effective data retrieval in computer science.Linear Search and
Binary Search
Introduction to Searching
Algorithms
Importance of Types Covered
Searching
Linear Search and Binary
Key operation in data Search, with key
retrieval and AI problems. differences.

Objective
Explain methods, efficiency, and use cases.
Linear Search Explained
Methodology

Check each element from start to target found.

Advantages

Simple, works on unsorted data, ideal for small sets.

Disadvantages

Slow for large datasets, inefficient for repeated searches.


Linear Search C Code
Example
Linear search iterates array checking elements against the target.
Returns index if found, otherwise -1.

This simple implementation requires no data sorting and has O(n)


time complexity on average.
Binary Search Explained
Methodology Advantages Disadvantages

Divide array, compare target with Much faster on sorted datasets Only for sorted data, complexity in
mid element, narrow search. with O(log n) complexity. implementation.
Binary Search C Code
Example
Uses low, high, and mid indices to iteratively search sorted array.

Returns index on success, -1 if target is absent. Reduces


comparisons exponentially.
Comparative Analysis
Feature Linear Search Binary Search

Data Requirement Unsorted or Sorted Sorted only

Time Complexity O(n) O(log n)

Space Complexity O(1) O(1)

Implementation Simple Complex

Application Low on large data High on large data


Efficiency
Real-World Applications
Linear Search Uses Binary Search Uses

• Small phonebook contacts. • Dictionary word lookups.


• Unsorted document scanning. • Sorted database indexing.
• Real-time system speed needs.
Conclusion and Key
Takeaways
Linear Search Binary Search
Simple, works with Optimized for sorted,
unsorted small datasets. large datasets with fast
lookups.

Choosing the Right Approach


Data size, order, and frequency of searches determine method.
THANK YOU

You might also like