2. problem solving and theory of computation Flashcards
computational thinking
the ability to think logically about a problem and apply techniques for solving it
pseudo-code
a human-readable method of writing the steps of an algorithm without any particular programming language
software
is the name given to any program written for the computer
analysis
the requirements and goals of the project must be established, and a data model created. the needs of the end user are considered, and alternative solutions to the problem may be suggested
design
data structures will be specified, algorithms, user interfaces, screen designs and reports will all be designed
implementation
the program code is written
testing
the whole system must be tested for the presence of errors, using selected test data covering normal, boundary and erroneous data
evaluation
the system is evaluated according to given criteria
exhaustive search
trying every possible combination of numbers
binary search
- look at the middle item of the list first. if this is the item being sought, stop searching
- otherwise, if the middle item is greater than the one being sought, the item you are looking for must be in the first half of the list so you can discard the second half. otherwise discard the first half of the list
- repeat with the new list until the item is found
the structures programming approach
aims to improve the clarity and maintainability of programs
sequence
one statement following another
block-structured langauges
e.g. python, pascal, and c#
allow the use of just 3 types of control structure
structured programming
important aspect - is to keep subroutines independent of the program which calls them, which means that they should not make use of global variables.
any variable declared in the main program should be passed as a parameter to a subroutine if it is needed.
top-down design
is the technique used of breaking down a problem into the major tasks to be performed; each of these tasks is then further broken down into separate subtasks, and so on until each subtask is sufficiently simple to be written as a self contained module or subroutine.
basically “very useful method of breaking down the problem into small, manageable tasks”
advantages of structured (modular) programming
- individual modules can be separately tested
- modules can be kept in a module library and reused in other programs
- large programs can be split into modules that are easier to read, debug and maintain
- several programmers in a team can work on separate modules, thus shortening development time for a large project
hierarchy charts
is a tool for representing the structure of a program, showing how the modules relate to each other to form the complete solution
limitations of hierarchy chart
- does not show the detailed program structure in each module e.g. does not show selection and iteration
algorithm
- it has clear and precise stated steps that produce the correct output for any set of valid inputs
- it must always terminate at some point
good algorithm properties
- it should only allow for valid inputs
- it should execute efficiently, in as few steps as possible
- it should be designed in such a way that other people will be able to understand it and modify it if necessary
what kinds of problem are solved by algorithms
- internet-related algorithms
- route-finding algorithms
- compression algorithms
- encryption algorithms