theory of computation (FSMs and problem solving) Flashcards
(problem solving and finite state machines) (15 cards)
What is an algorithm?
- A sequence of steps that can be followed to complete a task
- always terminate rather than looping
Pseudo code selection
IF name = ‘Emma’ THEN
—- OUTPUT ‘Hello Emma’
key points:
* single equals
* most functions are in caps
Iteration in pseudo code
FOR number ← 6 to 12
———OUTPUT number / 2
END FOR
WHILE number < 18
———-Number ← number + (number / 4)
END WHILE
What is abstraction?
- Getting rid of unnecessary detail from a problem, making it easier to solve
represental abstraction:
removing unneccesary details
generalisation/categorisation:
grouping by common characteristics
Information hiding
- Hiding all details of an object that do not form its main features
- simplifies a problem without changing the essence of it
Functional abstraction
Procedural abstraction
Data abstraction
Problem abstraction/ reduction
Decomposition
Composition
Automation
Finite state machines: what are they, rules they follow
- Always in a fixed state
- Have a finite number of states
- Can only ever be in one state
- State changes based on current state and input data
State transition diagrams: what are, rules they follow
- Visual representation of a finite state machine
- Have states (circles) joined by transitions (arrows)
- Have a start state (indicated w leading arrow)
- Have an accepting state (double circle)
- Transition functions shown as an arrow between states
State transition tables
Columns usually hold current state, input and next state