2.1 Algorithms part 2 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
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
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
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
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