Y9 Cs Unit 2: Algorithms

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

28 Terms

1
New cards
Algorithm
An unambiguous, finite, sequence of steps designed to solve a problem or complete a task.
2
New cards

Condition-controlled Repetition

A kind of loop repeated until a condition is met - used when the number of times around the loop is not known before the loop is started.

3
New cards

Count-controlled Repetition

A kind of loop repeated until a count is met - used when the number of times around the loop is known before the loop is started.

4
New cards
Dry Run

the process of executing the algorithm outside the machine, either in the programmer's head or using pencil and paper.

5
New cards
Finite
Having a start and an end - an important property of an algorithm
6
New cards

Flowchart

Graphical method of representing an algorithm using shapes and arrows.

7
New cards
Initialisation
the process of assigning the first (initial) value to a variable.
8
New cards
Input
data sent to a computer for processing.
9
New cards
Loop
a sequence of program statements that is repeated over and over again.
10
New cards
Output
data that was processed by and sent out from a computer.
11
New cards
Pseudocode
A method of describing an algorithm using a structure that is close to a real programming language
12
New cards
Repetition
Algorithmic construct in which a group of statements is executed repeatedly.
13
New cards
Selection
Algorithmic construct in which a Boolean condition is used to decide which instructions (if any) will be executed.
14
New cards
Sequencing
Programming construct in which a set of instructions is executed in the order in which they appear.
15
New cards
Trace Table
A method used to manually work out what variable values should be throughout the code. Each column represents a variable or output and each row represents a change in value of that variable.
16
New cards
Unambiguous
Clear and precise - an important part of each step in an algorithm
17
New cards
Validation

to check that the data entering a program, by any means, is fit for processing.

18
New cards
Variables
names associated with containers which programmers use to hold data. The contents can be changed during execution.
19
New cards

algorithms must be… (4)

  1. unambiguous

  2. finite

  3. sequenced

  4. solves problem / completes task


20
New cards

algorithms can be written in…

  1. plain english

  2. code / programming language

  3. flow chart


21
New cards

flowchart symbols and their functions (4)

  1. oval - start / end

  2. rectangle - processes (eg: maths / assignment)

  3. parallelogram - inputs / outputs

  4. diamond - yes / no decision (condition) used for selection and repetition


22
New cards

boolean condition V arithmetic expressions

boolean conditions are for comparisons with the answer of yes or no

arithmetic expressions are calculations with a number answer

23
New cards

trace tables are read from … to … , … to …

trace tables contain columns for … and an … column to track the changes of these things in an … during a … …


top

bottom

left

right

variables

output

algorithm

dry run

24
New cards

pre condition loops / top test iteration

A loop where the condition is checked BEFORE the loop runs.

25
New cards

post condition loops / bottom test iteration

A loop where the condition is checked AFTER the loop runs, so the loop always runs at least once.

26
New cards

GAP FILL: general approach to validation (5)


  • create a (1) loop control variable called (2) and set it to (3)

  • start a (4) which executes all the time when (2) is still (3)

  • inside the loop we get the (5)

  • ...and we check the (5)

  • ...setting (2) to (6) if it is acceptable or printing an error message if not.


boolean

valid

false

loop

input

true


27
New cards

HARDER GAP FILL: general approach to validation (5)


  • create a (1) called (2) and set it to (3)

  • start a loop which (4)

  • inside the loop we get the (5)

  • ...and we check the (5)

  • if (2) is (3) we… (6)

  • if (2) is True we… (7)


boolean loop control variable

valid

false

executes all the time while valid is still False

input

print an error message

leave it be

28
New cards

count controlled loops in flowcharts don’t have a while function, instead … is used which starts at … or … and is changed at the end of the loop with the expression …

a count variable

0

1

count = count + 1