2.1 Algorithms part 2 Flashcards

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

What are the advantage and disadvantage of using binary search?

A

Advantage:

  • Very efficient
  • Fast for large lists

Disadvantages:

  • only works on ordered lists
  • May not be effective with small lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the advantages and disadvantages of linear search?

A

Advantage:

  • Simple
  • works well with small lists
  • Works on unordered lists

Disadvantages:

  • Slow with long lists
  • Gets quite inefficient6
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the advantages and disadvantages of bubble sort?

A
Advantage:
- simple
- efficient to check if a list is already ordered 
- uses little memory
Disadvantages:
- inefficient
- Doesn't work well with large lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the advantages and disadvantages of merge sort?

A

Advantages:

  • efficient
  • Quicker than bubble
  • Consistent run time, no matter list length

Disadvantages:

  • Slow for small lists
  • Goes through huge process even if already sorted
  • lots of memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the advantages and disadvantages of insertion sort?

A

Advantage:

  • easily coded
  • works well with small lists
  • doesn’t need much memory
  • Quick at checking list is already sorted

Disadvantage:
- Doesn’t work well with large lists

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