Topic 1 - Problem Solving Flashcards

1
Q

What is an algorithm?

A

A set of instructions that perform a specific task.

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

What are algorithms used for?

A

Calculations, data processing and automated reasoning.

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

What are the 5 different representations of algorithms?

A

Flowcharts, Pseudocode, Structured English, Written descriptions and program code.

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

What are flowcharts?

A

Diagrams consisting of geometric shapes that help visualise a problem.

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

What is Pseudocode?

A

An informal description of a program or algorithm.

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

What is Structured English?

A

Similar to Pseudocode except symbols are often written out (e.g. ADD instead of +)

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

What is the purpose of algorithms?

A

To visualise the logical steps of a task.

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

What is a Quick Sort?

A

A quick and efficient algorithm used to put data into a particular order (often ascending/descending or rearranging letters of the alphabet)

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

What are the 4 steps to execute a Quick Sort algorithm?

A
  1. Select a pivot from the list
  2. Write down all the items less than and bigger than the pivot, keeping the order, in a sub-list.
  3. Write down the remaining items, keeping the order, in a sub-list.
  4. Repeat steps 1-3 until all items are chosen as a pivot.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Bubble Sort?

A

An algorithm that works by repeatedly stepping through a list, comparing each item with the following item, swapping them if necessary.

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

What is a Selection Sort?

A

An algorithm that splits the input list into two imaginary sub-lists: a sorted list and an unsorted list.

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

What are the steps to execute a Selection Sort algorithm?

A
  1. Swap the smallest element in the list with the first element in the list.
  2. Repeat the process with the nth smallest element and replace it with the element in the nth position in the list.
  3. Continue until the list is sorted.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a search algorithm?

A

Finds a specific item within a larger group.

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

How does a Linear Search algorithm work?

A

Checks every single item in the list until you find your search item, or fail to find it at all.

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

Why is a Linear Search algorithm not very efficient?

A

The time it takes is related to how long and where in the list the item is.

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

How does a Binary Search algorithm work?

A

Continually divides your list by two (hence BINARY), eliminating the part of the list that cannot have your item in it.

17
Q

How does a Breadth First Search (BFS) work?

A

Works by visiting nodes closest to the starting point first.

18
Q

How does a Depth First Search (DFS) work?

A

Works by visiting nodes as far into the graph as possible before backtracking to visit the previously unvisited nodes.

19
Q

How is algorithmic efficiency measured?

A

In terms of time (how long it takes to run) and space (how much memory is required).

20
Q

What are the factors that affect algorithmic efficiency?

A
  • How well designed the data structures are
  • The software and hardware
  • The programming language and translator used
21
Q

What is decomposition?

A

Breaking a problem down into smaller, more manageable sub-programs.

22
Q

What are two advantages of decomposition?

A
  1. Different people can work on different sub-problems

2. Able to compute the solution in parallel

23
Q

What are two disadvantages of decomposition?

A
  1. The problem must be understood well.

2. It can be difficult to combine the solutions