Problem Solving Flashcards

1
Q

What is algorithmic thinking?

A

Algorithmic thinking is a way of solving problems by producing algorithms.

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

What is an algorithm?

A

An algorithm is a reusable set of instructions (a series of steps) to solve a given problem.

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

How do we represent algorithms in computing?

A

In computing, we often represent algorithms using pseudocode or flow diagrams.

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

How do we interpret algorithms?

A

Look out for identifiers, identify inputs and outputs, examine output messages and looking for comments.

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

What are identifiers?

A

Identifiers are the names of variables, constants and subroutines. These give clues bout the purpose of an algorithm.

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

What are comments?

A

Comments are descriptions of the code. They often state the purpose of the algorithm. They are often the clearest way to identify an algorithm.

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

What is pseudocode?

A

Pseudocode is a way to write out algorithms using code-like statements. It is intended to be very readable, and easy to understand.

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

What is the purpose of pseudocode?

A

Pseudocode is not an actual programming language, it is used to plan algorithms, focusing on the logic and steps rather than language-specific syntax.

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

What are flow charts?

A

Flow charts are used to visually represent the steps that make up an algorithm.

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

What are ovals used for in flow charts?

A

An oval is used for the start and end of a program.

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

What are rectangles used for in flow charts?

A

A rectangle is used to represent a process.

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

What are parallelograms used for in flow charts?

A

A parallelogram is used to represent an input or an output.

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

What are diamonds used for in flow charts?

A

A diamond is used to represent a decision.

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

Why do the diamonds have labelled arrows coming out of it in flow charts?

A

A diamond/decision has two labelled arrows coming out of it to represent what happens if the condition in the diamond was true or false. ‘Yes’ arrows are for true, and ‘No’ arrows are for false.

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

What are the common mistakes in programming?

A

Incorrect identifiers - such as lowercase and uppercase letters and similar looking character like 0 and O.
Incorrect operators - like less than signs put in the wrong way.
Missing processes - like when line of codes are forgotten.

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

What is a search algorithm?

A

A search algorithm is a set of instructions for finding a specific item of data within a data set.

17
Q

What are examples of search algorithms?

A

Linear search and binary search.

18
Q

What is the concept of linear search?

A

If you were looking for a specific piece of paper in a stack of papers, then one way to find it would be to work from the top of the stack to the bottom, checking each paper on the way.

19
Q

How does linear search work in a program?

A

Check the first item in the dataset:
If it is what we are looking for, return it.
This is repeated for the rest of the items.
If the end of the data is reached, then the item was not in our data set.

20
Q

What are the pros and cons of linear search?

A

Pros - very easy to implement

Cons - slow on a long list

21
Q

What is the concept of binary search?

A

If you try to find a certain page in a book, it’s unlikely that you check every page. You are more likely to split the book in two and see if the page you need is before or after the split, and repeat.

22
Q

How does binary search work in a program?

A
Find the middle of the dataset.
If the middle value is > the target:
Repeat on the first half of dataset.
If the middle value is < the target:
Repeat on the second half of dataset.
If the middle value is the target:
The target has been found.
Stop repeating when the size of the dataset is zero.
23
Q

What are the pros and cons of binary search?

A

Pros - faster than linear search on a large dataset

Cons - dataset must be sorted before starting

24
Q

What is a sort algorithm?

A

A sort algorithm is a set of instructions to arrange a dataset into a particular order.

25
Q

What is efficient sorting?

A

An efficient sort algorithm is one which can sort a dataset in a short time.

26
Q

What are examples of sorting algorithms?

A

Bubble sort, merge sort and insertion sort.

27
Q

What is the concept of bubble sort?

A

There is a set of cards face up on a desk. If the first two cards are in the wrong order, you swap them. Do the same for the second and third cards, a continue in the same pattern until the end of the pack of cards. This is known as a pass. The highest value will ‘bubble’ up to the top of the pack each pass. By repeating this enough times, the pack of cards will be sorted.

28
Q

What is bubble sort in programming?

A

Compare the first two items of the dataset. If they are in the wrong order, swap them. Continue for the rest of the items of the dataset. Repeat the whole process, until a pass with no swaps happens.

29
Q

What are the pros and cons of bubble sort?

A

Pros - easy to implement and doesn’t use much memory

Cons - poor for efficiency

30
Q

What is the concept of a merge sort?

A

If there are two packs of cards, which are both already in order and want to combine them. The solution is to consider the top card of each pile only, and create a new deck starting from the smaller of the two cards. This will give us a combined sorted pack.

31
Q

What is merge sort in programming?

A

Split the lists in lists of size one. Merge each pair of sub lists by comparing the first value of each list and putting the smaller value into the new list first. Continue merging until there is only one list.

32
Q

What are the pros and cons of merge sort?

A

Pros - a very efficient algorithm

Cons - can be slower for small lists and needs additional memory

33
Q

What is abstraction?

A

Abstraction is a technique that simplifies a problem by removing unnecessary detail so that you can focus on the important parts that are relevant to the problem.

34
Q

What is decomposition?

A

Decomposition means breaking a complex problem, into smaller, more manageable sub-problems.
Each smaller part can then be solved individually, before all the sub-solutions are combined to solve the original problem.

35
Q

What are the advantages of decomposition?

A

It allows large teams to each take a part of a problem and work on it. It allows seemingly impossible problems to be solved by splitting them into simple tasks.

36
Q

What are structure charts?

A

Structure charts are used to visually represent breaking a large problem down into the smaller parts that make it up. Each box represents a smaller problem to be solved. Lines show which bigger problem the box is a part of.