Computation Flashcards
What is the definition of algorithm?
Set of instructions that can be followed to perform a task
How do you break down a problem?
- Does the problem have different levels
- Can it be broken down intol sections
- Can the sections be broken down further
- Each low level problem should be a single task
What is the sequence programing construct?
DO one statment after the other in order
What is the selection programming construct?
Do a set of instructions based on a condition
Allows for code to make choices
What is the iteration programming construct?
- Do a set of staments again
- For a fixed amount of times
- Or until a condition is met
What are the rules for pseudo-code?
- Descirbe each step breifly
- Upper case = Close to programming langauge
- Lower case = Closer to english
- Keywords to show beggining and ending of the block of code
What does hand tracing algorithms do?
- Looking at a printed extract of the program code and running through it like th computer
- Helps with understanding and finding any logical errors
What are the steps in hand tracing the algorithms?
- Take each line one at a time
- Write out current state of each variable in a trace table
- Note down any output that program would produce
- To help understand and spot any logical errors in the program
Trace this program?
Trace this program?
Trace this program
What is the process of abstraction?
Seperating ideas form reality
By hiding irrelevant details and only showing relevent data
What is representational abstraction?
- Arriving at a representation by removing unnecessary detail
- Like underground tube map only shows stations and intersections
What is abstraction by generalisation?
- Grouping by common characteristics to arrive at a hierarchical relationship of the is a kind of type.
- Going up is generalising
- Going down is specilising
What is the need for abstraction?
- Needed to accuratly display and model certain situation
- Depending on the level of detail needed
- Like a tube map vs tourist map of london
What are the different types of abstraction you need to know?
- Prodecural
- Functional
- Data
- Problem
What is prodecural abstraction?
- Abstracting away actual values
- Used in particular computation
- Which is a computational pattern
What is functional abstraction?
- Another layer of abstraction ontop of procedural
- Disregards the particular computation method
What is data abstraction ?
- Methodology that enables us to isolatehow a compound data object is used
- From the details of how it is constructed
Like how the operations in a stack hides how the data is represented in arrays and variables using subroutines to carry out that operation
What is problem abstraction / reduction?
- Removes details from a problem
- Until you can represent it that is posssible to solve
- As the problem has been reduced to one that already has been solved
*You can then unfold this graph and then find the shortest point (dijkstras algorithm) *
What is decomposition?
Taking big problems and breaking it down into smaller problems
What is step-wise refinement / top down modular design
- Top level is name of the problem
- Breaking down into more levels
- Which continues until the lowest level has only one task
What is composition?
- Botton up development
- Solutions developed by putting pre-exsisting components together
- Provent to work together
Lego - Predefined props hieght and width proven to interlock with each other
How is composition shown in programming langagues?
- Dev implements pre-written procedures
- Which are pre-tested, compiled and working
- Which are packaged into libaries which allow other developers to use
What are the steps in constructing computer science solutions from real world problems?
- Physiocal world scenrio
- Abstracted model to filter out uneccesary variables / side problems
- Construct algorithms based on abstracted model
- Implement algorithms using code and data structures
- Run code
How does automation apply to the real world?
- Once abstracted models are turned into mathmatical models
- We can use automation in the implementation of those models to process data much faster
- Allowing breakthroughs in science like medicine and great discoveries
What is a finite state machine?
- Abstract model of computation (how machine reacts to external events)
- Used to design computer programs and sequential logic circuits
- Can be one of a finite number of states at any one time
- Changes state based on a trigger condition or some input
- Visuallised through state transition diagrams
What is the structure of the FSM?
- Start state - where FSM begins
- Transition States - Allow us to move from one state to another
- Transition condition - Condition / input required to change state
What is the state transition table for this FSM?
What is a meanly machine?
- FSM with an output
- Output determined by both current state adn current input
- Input for each condition / Output for using transition arrow
What are sets in maths?
- An Unordered collection of values or symbols in which each value or symbol occurs at most once
What does a finite set mean?
A set whose elements can be counted off by natural numbers up to a particular number
What does cardinality mean in sets?
The numbe of elements in a set
What is an infinite set?
- A set which has no end value
- Represented by (“…”) at end of set
What is a countable set?
- Can be finite set or a countably infinite set
- A set which can be counted off against a subset of natural numbers
- Where every element of a set is associated with a unque natural number
What are the different expression symbols you need to know?
How do you understand expressions?
- Write out expression in plain english
- Using expression symbol meaning
What is the cartesian product?
- The product of two sets
- Which is the set of all ordered pars (a,b)
- Where a is a memeber of set A
- And b is a member of set B
(All Combinations of the two sets elements)
What is subsets and proper subsets in maths?
What is the union in maths?