PadhaikoAll subjects

Past exam question: 2066 Jestha (Back), Q8(b)

Data Structure and Algorithms · 2 marks

Open in the Padhaiko app

Topic: Searching Algorithms

Question

Compare the sequential search and binary search in terms of Big 'O' notation with an example.

Solution

Big-O Comparison of Sequential vs. Binary Search:

Example: Searching for 99 in a sorted 1,024-element array takes up to 1,024 comparisons in sequential search () versus at most comparisons in binary search ().

Answer:

Sequential search is (works on unsorted data), while binary search is (requires sorted data)—requiring at most vs. comparisons on 1,024 items.

All past exam questions for Data Structure and Algorithms