1 Fundamentals of algorithms Flashcards
define algorithm
a series of instructions that can perform or execute a specific task
define decomposition
a technique where you take a problem and you break it down into smaller parts
define abstraction
a technique where you take out unnecessary or extra parts of a problem to make it easier
what is the formula for calculating file size?
File size(bytes) = Sample rate * Sample Resolution * time (in seconds) / 8
what is the formula for calculating total bytes for a bitmap image?
Total number of bytes for a bitmap image (file size) = colour depth x width x height / 8
State 2 effects of increasing the number of pixels the image is made up of
1) You can zoom into the picture more before it becomes pixelated
2) it would increase the file size
how are sound waves converted and stored in a computer?
A microphone/sound sensor picks up the sound wave
The wave is converted to an analogue signal
The amplitude/height is measured
These measurements are called samples and take place at regular intervals
These samples are stored as binary values in the computer
what will happen if u increase the sample rate?
the file will be truer to its original sound, the file quality will increase.
how do you calculate bit rate in sound?
Bit rate = sample rate x bit depth
what 3 factors can affect the size of a sound file?
duration, sample rate, and bit depth
what is the pseudocode for converting from denary to binary?
Output(“What number do you want to convert?”)
numberD <– USERINPUT
While numberD <> 0 do
Repeat
numberD / 2
Until numberD = 0
Repeat
Remainder <– NumberD MOD 2
Until numberD = 0
End while
what is binary shift left basically?
multiplying by powers of two
what is binary shift right basically?
dividing by powers of two
State the arithmetic effect of applying a left binary shift of 6 followed by a right binary shift of 8 on a binary number
The number would be divided by 2^2
State the arithmetic effect of applying a left binary shift of four on a binary number
Multiplying it by 2, 4 times/ Multiply by 2^4