2.1- Algorithms Flashcards

(12 cards)

1
Q

Decomposition

A

Breaking a complex problem down into smaller problems and solving each one individually

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

Algorithmic thinking

A

A logical way of getting from the problem to the solution. If the steps you take to solve a problem follow an algorithm then they can be reused and adapted to solve similar problems in the future.

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

Abstraction

A

Picking the important bits of information from the problem, ignoring the specific details that don’t matter

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

Binary search

A

Keep comparing with the middle item in an ordered list

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

Linear search

A

Check each item of a list in turn to see if it’s the correct one

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

Linear vs binary search

A

Linear search is much simpler, but not as efficient. Linear can be used on any type of list, doesn’t have to be ordered. Binary is more suitable for a large list.

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

Bubble sort

A
  • look the first two items on the list
  • If they’re in the wrong order, swap
  • Do the same for the next pair of items, until the end of the list
  • Repeat until there are no swaps in a pass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Bubble sort pros

A
  • simple algorithm
  • efficient way to check if a list is a;ready in order
  • doesn’t use very much memory (all sorting is done using the og list)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Bubble sort cons

A
  • inefficient
  • doesn’t cope w very large lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Merge sort pros

A
  • more efficient than bubble sort
  • consistent running time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Merge sort cons

A
  • Slower for small lists
  • goes through whole process even if list is sorted
  • uses more memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Incersion sort (orders the items as it goes)

A
  • look at the second item in a list
  • compare to all items before it and insert the number into the right place
  • Repeat until the last number in the list has been inserted into the correct place
How well did you know this?
1
Not at all
2
3
4
5
Perfectly