3.1.3 Searching Algorithms Flashcards

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

Hoe does the Linear search Algorithm work?

A

It goes through each piece of data 1 by 1 until data is found (if data not found it just goes through start - end)

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

How does the Binary search Algorithm work?

A

Repeatedly dividing the list of data in half and discarding the half that does not have relevant data

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

Advantage of Linear search

A

Is very efficient for small/ medium length arrays

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

Disadvantage of Linear search

A

If a long array is used the time for data to be found is too long and complex

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

Advantage of binary search

A

Better time complexity

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

Disadvantage of binary search

A

Only works if the data is in order

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