Search Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Types of Search Algorithms

A

Binary Search
Linear Search

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

Binary Search

A
  1. Find middle term in ordered list
  2. If this is the item you are looking for, stop search
  3. If not, compare item being looked for to the middle term
  4. If it is before the middle term, get rid of second half of the list
  5. If it is after the middle term, get rid of first half of list
  6. Repeat with smaller list until item is found
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Linear Search

A

Checks each term in a sequence sequentially until the item being looked for is found

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

Disadvantages of Linear Search

A

Not efficient, so only can be used on small lists

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