2.1 Flashcards
what is abstraction
the process of removing unnecesary details ad only including relevant details
what is decomposition
breaking down complex tasks into smaller manageable tasks
advantages of abstraction
allows the focus of what is important in problem solving
advantages of decomposition
makes tasks easier to manage
different people can work on different tasks at the same time, reducing time
program components can be easily used in other components
what is algorithmic thinking
a way of getting to a solution by identifying the individual steps needed
what is an input
anything which needs to be supplied to the program to meet its goals
what is usually created for an input
an appropriate variable name and data type
how does algorithmic thinking work
- it creates sets of rules, an algorithm that follows it precisely leads to its solution
- for example, algorithms for doing multiplications will work 100% of the time if you follow the rules to get the result
how are structure diagrams created
- they are produced using the method, step-wise refinement
- the problem is broken down using decomposition into smaller components (some problems will need more decomposition than others)
- the lowest level nodes should achieve a single task
- these can then be coded as a single or sub-program
what do outputs do
they consider what the program needs to output
consider what form this output needs to take
consider an appropriate variable name and data type for any output
what is a structure diagram
it is a method of designing a solution to a problem by illustrating the problem using decomposition
what is pseudocode
an alternate text-based way of representing the sequence of steps in an algorithm
advantages of using pseudocode
it allows us to lay down the logic of a problem without worrying about rules of syntax
what is the terminal symbol (oval shaped) in a flow diagram
shows the start or end of a process
what is the process symbol (rectangular shaped) in a flow diagram
shows that something is initialised, processed or calculated
what is the decision symbol (diamond shaped) in a flow diagram
shows yes or no, true or false
what is the input/output symbol (rhombus shaped) in a flow diagram
shows an input and output of data to the algorithm
what is the subroutine symbol (rectangle with stripes) in a flow diagram
it is used to call a subroutine (separate function)
what is the line in a flow diagram
controls passing between connected shapes
name the different types of errors
- syntax errors, which are grammatical rules of programming language
- they stop code from being translated
- logic errors, which produce unexpected outputs
- on their own they will not stop programs from running
what is tracing execution
- used for testing the accuracy of an algorithm for logic
- it involves examining a printed extract of program code and running through the program
what is a trace table
- used for noting down any output the program produces
- each variable present in the program should have its own column in the trace table
- a new row should be added under any column if the state of a variable changes
advantages of trace tables
they are a good way to track down logic errors in a problem
how does binary search work
- calculate a midpoint in the data set
- check if that is the item to be found
- if not…
- if the item to be found is lower than the midpoint, repeat on the left half of the data set
- repeat until the item is found or there are no items left to check
- requires the data set to be in order of a key field