SECTION 5 - Algorithms Flashcards

1
Q

Three key techniques for computational thinking

A

Decomposition, abstraction, algorithmic thinking

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

Decomposition

A

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

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

Abstraction

A

Focusing only on important pieces of information from the program and ignoring the specific details that are not important.

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

Algorithmic thinking

A

A logical way of getting from problem to solution. Algorithm can be reused and used to solve other similar problems.

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

Pseudocode

A

Mixture of English and programming language to show steps that program takes.

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

What is flowchart symbol for start/stop?

A

Oval

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

What is flowchart symbol for input/output?

A

Parallelagram

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

What is flowchart symbol for processes?

A

Box

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

What is flowchart symbol for decision?

A

Diamond

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

Binary search process

A
  1. Find middle item in ordered list
  2. If this is item, stop search.
  3. If not, compare middle item with item you are looking for.
  4. If it is after middle item, remove first half of list. If it is before middle item, remove second half of list.
  5. Repeat until item is found.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Linear search process

A
  1. Look at first item of list.
  2. If this item, stop search.
  3. If not repeat 1-2 until item is found
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Bubble sort process

A
  1. Look at first 2 items, if in correct order, nothing will happen but if they are in incorrect order, they will be swapped.
  2. Move on to next pair of items and repeat 1.
  3. Repeat 3 until end of list is reached - called one pass. DO NOT INCLUDE LAST NUMBER IN NEXT PASS as it will now in correct place.
  4. Repeat passes until list is ordered.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Pros of bubble sort

A
  • Simple algorithm
  • Efficient way to check if list is already in order
  • Does not use a lot of memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Cons of bubble sort

A
  • Inefficient
  • Due to being inefficient, it cannot cope with large lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Merge sort process

A
  1. Split list in half into 2 subsists. Second sub list should start at the middle item.
  2. Repeat 1 until all sub lists only contain 1 item
  3. Merge pairs of sublist, so each one has twice as many items. Each time sublist is merged, sort items in correct order
  4. Repeat 3 until all items are ordered.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Pros of merge sort

A
  • More efficient that bubbe, insertion sort
  • Consistent running time
17
Q

Cons of merge sort

A
  • Slower that other sorts for short lists
  • Even list already ordered, carries out same slow process
  • Uses more memory
18
Q

Insertion sort process

A
  1. Looks at second item in list
  2. Compares to items before and inserts items before into correct order
  3. Repeat 2 for every other item until last item is inserted correctly
19
Q

Pros of insertion sort

A
  • Very quick at checking if list is already ordered
  • Intuitive way of sorting, can be easily coded
  • Copes well with small lists
20
Q

Cons of insertion sort

A
  • Does not cope well with large lists