Flashcards in Topic 1 Problem Solving Deck (24):

1

## What is an algorithm?

### A step-by-step procedure for solving a problem or carrying out a task. It is not programming code.

2

## Why are algorithms needed?

### To improve efficiency by removing the need for human input.

3

## Describe the algorithm construct - SEQUENCE

### Instructions provided and executed in the correct order.

4

## Describe the algorithm construct - SELECTION

### Choosing which part of an algorithm to run based on a condition being true or false.

5

## Describe the algorithm construct - ITERATION

### Steps in an algorithm are repeated for a set number of times, or until a condition is met.

6

## How might algorithms be represented?

### Pseudo-code / Flowcharts / Structured English.

7

## What is Pseudo-code?

### A way of expressing an algorithm in English, that resembles a computer language.

8

## What is a flowchart?

### A diagrammatic way of representing an algorithm using symbols/text linked with arrows to show the 'flow' through the algorithm.

9

## In flowcharts, what symbol is used to represent the start/end?

### Rounded rectangle.

10

## In flowcharts, what symbol is used to represent a decision/selection

### Diamond, with two possible outcomes, Yes/No, True/False etc.

11

## In flowcharts, what symbol is used to represent a process?

### Rectangle.

12

## In flowcharts, what symbol is used to represent control passing between other symbols?

### Arrow.

13

## In flowcharts, what symbol is used to represent a subroutine?

### Rectangle, with an extra line at both sides.

14

## What is a dry-run?

### Using a pen/paper to investigate the FUNCTIONING of an algorithm.

15

## What is the purpose of a trace table?

### To write down (pen/paper) the values of each variable during the execution of an algorithm.

16

## What is meant by a syntax error?

### An error in the language used, eg PINT instead of PRINT

17

## What is meant by a logic error?

### An error which produces an incorrect result/output. Eg Multiplies instead of divides.

18

## What is meant by a run-time error?

### An error that would cause the program to crash during execution. Eg divide by zero.

19

## Describe the linear search algorithm.

### An attempt to find an item in an array which starts at the beginning of the array, checks each item in turn, stops when the item is found, or the end of the array is reached.

20

## Describe the binary search algorithm.

### Array must be sorted first. Select the middle value and compare with the search item. If the search item is lower, discard the middle value and the higher items to the right. If the value is higher, discard the middle value and the lower items to the left. Repeat until the search item is found, or not in the list.

21

## Describe the bubble sort algorithm to sort into ascending order.

### Go through the array starting at the second item. Compare this with the value before it. If first value is higher than second value, swap the items. Repeat this until all items are in their correct place.

22

## Describe the merge sort algorithm.

### An array is divided into two repeatedly until each array has only one item. The arrays are then progressively merged with the items into the correct order.

23

## What is meant by decomposition?

### Breaking a large problem down into sub-problems or components. These smaller components are easier to understand and solve. Once all of the components are solved, the large problem is solved.

24