Computing#1-Algorithms Flashcards

1
Q

Computational thinking

A

3 techniques:
Decomposition-Breaking down a complex problem into smaller problems and solving individually.
Abstraction-picking out important bits of information from the problem and ignoring specific details that don’t matter.
Algorithmic thinking-logical wash of getting from problem to solution. If the steps taken follow an algorithm, they can be used to solve a future problem.

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

Search algorithms

A

Binary search-Keeps halving a list until it finds the item its looking for. Eg it looks at the middle item at the start. If the item it’s looking for is on the right side, it will exclude the left side vice versa. It will keep looking at the middle item and excluding halves until it finds the item it’s looking for
Linear search-looks at every item in a list in turn until the end or until it finds the term. Simpler than binary but not as efficient for larger lists.

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

Bubble Sort

A

Swaps individual pairs of items. Passes through the algorithm several times until it has sorted the entire algorithm.

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

Pros of bubble sort

A

Pros: Simple algorithm, easily implemented on a computer
Efficient way of checking if a list is already in order. (Only one pass is needed)
Doesn’t use much memory.

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

Cons of bubble sort

A

Inefficient way of sorting a list.

Slow for large lists of items

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

Merge sort

A

Splits list apart into lists that eventually only contain 1 item. Then they are merged together in order, starting with pairs, fours,eights etc until list is sorted. Use common sense if list is odd. The second sub list should start at middle item.

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

Pros of merge sort

A

More efficient and quicker that bubble for large lists, similar running time for smaller lists.
Consistent running time no matter how ordered items in the original list are.

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

Cons of merge sort

A

If list is already sorted, it still splits and merges, so bubble may be quicker in some cases.
Uses more memory than a bubble sort as it has to create additional lists.

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