Binary Search + Preconditions Flashcards

(3 cards)

1
Q

What is binary search?

A

More efficient than linear

compares the middle item to the searched for target item, if the values match then the index is returned.

if the middle item is larger, the top half of the list is ignored

repeat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the list have to be for a binary search to be possible?

A

Sorted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Binary search benefits

A

Very efficient

time complexity of 0(logn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly