Searching Algorithms Flashcards

1
Q

Linear Search

A

looks through a list of items and finds if a value is in the list. It checks every item in the list and compares it to the search item

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

Binary Search

A

Works by splitting the list in two until the item is found

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

Name 4 advantages of linear search..

A

Simple to code
Quite efficient for short lists
Doesn’t requires ordered data
Helps for algorithms such as max/min

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

Name 1 disadvantage of linear search

A

Very slow on large lists

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

Name 1 advantage of binary search

A

Fast on any length of list

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

Name 2 disadvantages of binary search

A

Complex code

Data has to be ordered

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