2.1 - Algorithms Flashcards

1
Q

What is an algorithm?

A

A sequence of steps that can be followed to complete a task

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

What is algorithmic thinking?

A

Following logical steps to solve a problem

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

What is abstraction?

A

Ignoring unnecessary information to simplify a problem

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

What is decomposition?

A

Breaking down a problem into smaller tasks so it is easier to solve

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

In a flowchart what represents start/stop terminators?

A

A ‘squircle’ (square-circle) ▢

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

In a flowchart what represents subroutines?

A

A rectangle with a vertical line either side

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

In a flowchart what is represents the direction of flow?

A

An arrow

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

In a flowchart what represents an input or output?

A

A parallelogram

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

In a flowchart what represents a process?

A

A rectangle

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

In a flowchart what is used to represent a decision?

A

A diamond with two branches (yes and no)

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

How do you use a trace table?

A
  • Go through every line
  • Only add to a column when that column’s value changes
  • (Generally) move onto a new row when you move into a new ‘block’ in the code
  • Gaps are fine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a linear search?

A

Compares each item one by one until the target is found or the end of the list is reached

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

What are the advantages of using a linear search?

A
  • No need for the list to be in order
  • Quick process for short lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the disadvantage of using a linear search?

A

Long process for long lists

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

What is a binary search?

A
  • Compares middle item to the target
  • Discards half of the list which the target can’t be in
  • Finds the next middle item and repeats until the target is found/runs out of items
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the advantage of using a binary search?

A

Time efficient in a large data set

16
Q

What is the disadvantage of using a binary search:?

A

Needs to be in order beforehand

17
Q

What is bubble sort?

A
  • In one pass, go through each pair, swapping if needed
  • Repeat passes until a pass happens with no swaps
18
Q

What is merge sort?

A
  • Divides the list continuously by two until each list has 1 item
  • Combines two lists at a time, keeping the items in order
19
Q

What is insertion sort?

A

Starts with 1 item in the ‘sorted part’ and moves items one by one from the ‘unsorted part’ to the ‘sorted part’