---
title: "Sequential vs binary search"
subject: "Data Structure and Algorithm"
chapter: 8
key: "semester_4/data_structure_and_algorithm:sequential-vs-binary-search"
source: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/sequential-vs-binary-search
site: BCT Engineering
---

# Sequential vs binary search

Data Structure and Algorithm · Chapter 8: Searching

- Asked in: 2075 Baisakh, 5 marks
- Video: [Linear search vs Binary search](https://www.youtube.com/watch?v=sSYQ1H9-Vks) — Techdose
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/sequential-vs-binary-search
- Whole chapter: https://www.bctengineer.com/md/semester_4/data_structure_and_algorithm/chapter-8

## Question

Compare sequential search with binary search.

## Short answer

Sequential search works on sorted or unsorted data, worst O(n). Binary search requires a sorted array and direct access, worst O(log n), making it much faster for large lists.

## Answer

| Point | Sequential (linear) search | Binary search |
|---|---|---|
| Idea | Compare key with each element in order | Compare with middle element, discard half |
| Data order | Works on sorted or unsorted data | Data must be sorted |
| Time (worst) | O(n) | O(log n) |
| Time (best) | O(1) (first element) | O(1) (middle element) |
| Data structure | Array or linked list | Needs direct access, i.e. array |
| Code | Very simple | Slightly more complex |
| Best for | Small or unsorted lists | Large sorted lists |
| Average comparisons | about (n+1)/2 | about log₂ n |

Example: to find a key in 1,000 sorted items, sequential search may need up to 1,000 comparisons, binary search at most 10.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which statement is correct?
   A. Sequential works on unsorted data; binary needs sorted data
   B. Binary works on unsorted data
   C. Both need sorted data
   D. Sequential needs sorted data
   Answer: A. Binary discards halves, which requires order. (Key point: Data order)

2. What are worst-case times?
   A. Sequential O(n), binary O(log n)
   B. Sequential O(log n), binary O(n)
   C. Both O(n)
   D. Both O(log n)
   Answer: A. Binary halves the range. (Key point: Worst case)

3. Binary search needs which structure?
   A. Array with direct access
   B. Linked list
   C. Stack
   D. Queue
   Answer: A. It must jump to the middle. (Key point: Structure)

## Related in Data Structure and Algorithm

- [Sequential search and sentinel](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Asequential-search-sentinel) — Data Structure and Algorithm, chapter 8
- [Binary search with algorithm and example](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Abinary-search-algorithm-example) — Data Structure and Algorithm, chapter 8, asked 4×
- [Binary search for 54 in sorted data](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Abinary-search-54) — Data Structure and Algorithm, chapter 8
- [Binary search for 89; hash functions](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Abinary-search-89-hashing) — Data Structure and Algorithm, chapter 8
- [Complexity of binary search](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Abinary-search-complexity) — Data Structure and Algorithm, chapter 8
- [Sentinel in sequential search](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Asentinel-sequential-search-importance) — Data Structure and Algorithm, chapter 8

## Related in other subjects

- [Informed vs blind search; DFS vs BFS](https://www.bctengineer.com/question.md?key=semester_6%2Fartificial_intelligence%3Ainformed-vs-blind-search-dfs-bfs) — Artificial Intelligence, chapter 3
- [Combinational vs sequential; JK flip-flop](https://www.bctengineer.com/question.md?key=semester_2%2Fbasic_electronics_engineering%3Acomb-vs-seq-jk) — Basic Electronics Engineering, chapter 6
- [Combinational vs sequential; BCD-to-decimal decoder](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Abcd-to-decimal-decoder) — Digital Logic, chapter 4
- [Combinational vs sequential; latch as bounce eliminator](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Alatch-bounce-eliminator) — Digital Logic, chapter 6
