Save
...
Paper 1
Fundamentals of Algorithms
Searching algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Shana Seruwo
Visit profile
Cards (9)
What is linear search?
a searching algorithm which can search a
sorted
or
unsorted
list
What is an ideal scenario for linear search?
The data set is small and
unordered
Why could linear search be inefficient?
If the item to be found is at the end of the
data set
, it would have to look through all the data before the item to find it
In the worst case scenario for linear search, what is it's time complexity?
o(n) - when the item is the last one in the list with n being the number of items in the list
In the best case scenario for linear search, what is it's time complexity?
o(1)
- when the item is the first one in the list
What is the overall time-complexity for linear search and why?
O(n)
because as the data set grows, more searching must be performed
What is binary search?
A searching
algorithim
which starts at the middle item of a
list
and repeatedly divides the list in half
What is a disadvantage of binary search ?
Needs the list to be
sorted
before searching
What is an advantage of binary search?
Is efficient for
large datasets
unlike
linear search