1/5
searching, sorting lists
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
list the details describing a linear search
Does not have to be sorted.
Search only terminates when element is found or end of list is reached (meaning item is not in list)
Best case scenario: first item
Worst case scenario: last item
Uses while loop for increase in efficiency
how do linear searches work?
what is the time complexity of a linear search
O(n)
list the details describing a binary search
lists needs to be sorted
more efficient than linear search
Best case scenario: first midpoint
Worst case scenario: Log2(n)
how do binary searches work?
how to find worst case scenario: binary search