3.1 - algorithm/efficiency Flashcards
flowcharts, data types, tracetable
define decomposition
the process of breaking down a complex problem to smaller sub-problems and solving them individually
define abstraction
Removing unnecessary detail from a problem
define an algorithm
a sequence of steps which are carried out in order to solve a problem
what are the benefits of decomposition and abstraction?
easier to solve a problem
what data type is able to store the following data?
100, 1, 3
Integer
give an example of decomposition in real life
process of making a car
- making the engine
- making the wheels
give an example of abstraction
not focusing on the additional paths on an underground map
what is generalisation
the process of creating one solution to a problem, which can then solve many different problems
define algorithmic thinking
the ability to be able to solve problems by creating algorithms
what is functional decomposition
splitting up a problem into smaller problems, each would be programmed using subroutines
what is selection
the ability to run different parts of the algorithm based on a condition
what are parameters
limits of the inputs in an algorithm
what is a dry run of a pseudocode?
when a code is run by programmers instead of computers
what are the advantages of dry runs
being able to see where logical errors and bugs are
what is the purpose of a trace table?
To show the value of each variable while an algorithm is dry run
Is a computer program an algorithm?
It is an implemention of an algorithm, not an algorithm itself
Define pseudo code?
A text based way of setting out an algorithm
What is casting?
The process of declaring the data type to be used (when assigning to a variable)
Ie. Phone
Give examples of iteration in a code?
- WHILE
- FOR
- DO
(Running the same code repeatedly)
Give two ways to measure the efficiency of an algorithm?
- measure the time taken
- measure the space used
If you measure the time efficiency, what do you measure?
- TAKE A PAUSE, THINK ABOUT IT
The number of steps in the algorithm (not time taken to complete)
πΎπΎπΎπΎπΎ
Disadvantage of writing efficient algorithms?
- efficient algorithms can be more complicated + hard to code than non-efficient ones
- may need other requirements (ie. binary search only works on ordered lists)
What is a computer program an implementation of?
Implementation of an algorithm
ALGORITHM IS NOT A COMPUTER PROGRAM
what does it mean if something is language independent?
means an algorithm can be written in any programming language