1.3
No description yet. This curated deck is ready for daily study.
Card preview (24)
Algorithm
A set of instructions designed to solve a problem
Identifier
A name given to an element of a program so it can be referred to throughout
Good Programming Practice
• Meaningful names, clear what variable is holding • Annotation, easier for programmers to follow • Program Layout, see each function and aids readability
Variable
An attribute within a program whose value can be reassigned (during execution)
Constant
An attribute within a program which never changes its value (during execution)
Global Variable
• Declared at the top of the program • Available to the whole program
Local Variable
• Declared inside a subroutine • Available only to that subroutine
Sequence
Steps processed once
Selection
• Uses a logical condition to determine which line of code to process next • Purpose: to execute code if a certain condition is met
Nesting
When another selection statement is contained within an existing selection statement
Repetition
Purpose: to repeatedly execute code until a certain condition is met
Count
A value in a loop that will increase/decrease each time the loop is executed
Rogue Value
a value which tells the computer that input has finished
DIV
// How many times one number goes into another
MOD
% Remainder after DIV
Lossy Compression
• Cannot be decompressed to yield back the original data • Not Good method for critical data such as text • Good for digitally sampled analogue data e.g. Sound/Video/Graphics • Algorithms vary but many use threshold truncation
Lossless Compression
• Original message can be decompressed back to it’s original form • Good for text • Good for high quality media e.g. .FLAC .PNG
Character Combinations (Compression)
Finding frequently occurring character combinations and replace them with tokens
Run Length Encoding
Replace long strings with a number
Photo Compression
Approximate all shades of blue in a photograph to one shade and only store this colour instead of every pixel
Sub Sections
• Algorithms and programs can be broken down into smaller parts. • These are named, reusable pieces of code that can be called any number of times within an algorithm to perform a specific task.
Sub Sections Advantages
• Can be developed by teams, easier to write. • Code is more readable • Avoids duplication of code. • Sections can be tested individually.
Standard Module and Function
STANDARD FUNCTION Carries out a common task for a standard situation in a program and is provided by the compiler/interpreter STANDARD MODULE Contains a group of related standard functions EG: Module = math Function = math.cos(x)
Standard Module Advantages
• Pre-written / No need to write again (Saves Development Time) • High Quality as written by experts • Already Tested/Used – Less Errors