Topic 4 - Theory of computation - Complete Flashcards

1
Q

Define top-down design? (Stepwise refinement)

A

Is used to plan a solution based on a top-down strategy.

Breaking down the problem into smaller steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

4 advantages of top-down design?

A
  • Breaking problem into parts helps clarify what needs to be achieved.
  • Each stage creates smaller sub-problems, so easier to solve.
  • Some functions or parts of the solution might be reusable.
  • Breaking a design into parts allows more than one person to work on the solution.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define an algorithm?

A

Is a step-by-step approach to solving a problem.

Written in pseudocode.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define abstraction?

A

Is the process of including only the important features when solving a problem.

This reduces the complexity of the system by removing unnecessary details.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define representational abstraction?

A

Is where all unnecessary details are removed, leaving only the information required to solve the problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define generalisation abstraction?

A

Is where a problem is simplified by grouping similar parts into a hierarchal structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define information hiding?

A

Is the principle that the details of the implementation of a class or software component are hidden or not accessible by the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define procedural abstraction?

A

Are large programs are written by breaking them into smaller subprograms, this approach applies to all languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define functional abstraction?

A

The exact computational method used is hidden, unlike procedural abstraction, the use of built-in or library functions is an example of functional abstraction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define data abstraction?

A

Is where the details of how a compound data object is constructed are isolated from how the data object is used.

Therefore, the primitive data objects that make up a user-defined data structure are hidden from the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Define problem abstraction?

A

Is where the details of the problem are successively removed or reduced until the problem is represented in a way that is straightforward to solve.

Once the unnecessary details are removed, the problem can be more clearly identified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define procedural decomposition?

A

is the process of breaking down a problem into a series of sub-problems, where each sub-problem archives an identifiable task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define composition?

A

Is the process of creating a system by combining the tasks identified in the decomposition abstraction.

Is the opposite of decomposition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

3 step process of composition?

A
  • Writing procedures for each of the tasks and sub-tasks identified in the decomposition.
  • Linking these procedures to create compound procedures.
  • Creating the necessary data structures to support the compound procedures.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define composition abstraction?

A

Compound procedures can be created by combining other procedures to be built.

Compound data objects can be created by combining data primitive objects of programming language to build a data abstraction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

State the processes of automation?

A
  • Creation of algorithms
  • Implementing the algorithms in program code
  • Implementing the models in data structures
  • Executing the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Define finite state machine (FSM)?

A

Is an abstract machine that can be in any one of a finite number of states. FSM’s can only be in one state at a time and a transition to a new state is triggered by an event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Define state transition diagrams?

A

Are used to describe an FSM in a graphical format, where each state is shown as a circle and each transition is connected to a circle by an arrowed line with a description of the input that causes the transition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Define state transition tables?

A

Are a method used to record all the sates and transition possible from finite state machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Define decision ables?

A

Can be used to model logic sequences in a compact way.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Define Mealy machine?

A

Is a finite state machine with outputs.

The output from a mealy machine is determined by its present state as well as its present input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Define a set?

A

A collection of elements - such as objects or numbers, each element is unique within the set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What would set A and B look like?

A
A = {1,2,3,4,5,6}
B = {-1,1,3,5,7,9}
24
Q

What does the set comprehension to define a set look like?

A
B = { x | x ∊ N ^ n < 5 }
- The vertical bar | 	means “such that”
- The ∊ symbol indicates membership so x ∊ N is 
   read as “x belongs to N”
- The ^ symbol means “and”
25
Q

Define finite set?

A

Is a set with a finite number of elements, the number of elements of a finite set is a natural number.

{1,2,3,4,5,6}

26
Q

Define cardinality?

A

Is the number of elements in a list

{1,2,3,4,5,6} = cardinality of 6
{} = cardinality of 0
27
Q

Define infinite set?

A

A set of infinite elements, examples include integers (Z), natural numbers (N) and real numbers (R).

Maybe countable or uncountable.

28
Q

Define Cartesian product of two sets?

A

The Cartesian set contains an infinite number of elements, which cannot be mapped one-to-one to the set of natural numbers. The set of real numbers (R) is an infinite uncountable set.

29
Q

Define subset?

A

is a set where all the elements of one set are elements of another set. A ⊆ B

A = {1,2,4,6}
B = {4,6,1,2}
30
Q

Define proper set?

A

Is a set that does not include all the elements of the set to which it belongs. A ⊂ B

A = {1,2,4,6}
B = {4,6,1,2,9,13}
31
Q

What are the 4 set operations used to define the relationship between two or more sets?

A
  • Membership
  • Union
  • Intersection
  • Difference
32
Q

Define membership?

A

Is a set operation used to check whether an element is a member of a particular set.

33
Q

Define Union?

A

Union of two sets is the set that contains all the elements of these sets.

Union of A U B:
A = {1,2,4,6} B = {1,4,8,9,13}
A U B = {1,2,4,6,8,9,13}

34
Q

Define Intersection?

A

The intersection of two sets is the set that contains only the elements which are in both sets.

Intersection of A ⋂ B:
A = {1,2,4,6} B = {1,4,8,9,13}
A ⋂ B = {1,4}

35
Q

Define difference?

A

The difference of two sets A - B is the set that contains all the elements of A that are not in B.

Difference of A - B:
A = {1,2,4,6} B = {1,4,8,9,13}
A - B = {2,6}

36
Q

Define a regular expression?

A

Is a notation used to describe a pattern of characters in an object or a set.

37
Q

What are the 5 regular expression rules using a & b?

a - pattern matches the string ‘a’.
b - pattern matches the string ‘b’.

A

ab - Concatenation where the pattern matches the string ‘a’ followed by ‘b’.
a+ - Pattern matches one or more ‘a’. {a, aa, aaa}
a* - Pattern matches zero or more ‘a’. {0, a, aa, aaa}
ab?c - Matches the preceding character one or zero times. {ac, abc}
a|b - Pattern matches symbol ‘a’ or ‘b’

38
Q

What is the order for regular expression notation?

() + ? | *

A

(), *, +, ?, |

39
Q

Define regular language?

A

Is a formal language that can be represented by regular expressions, it is a language that is acceptable for use by an FSM.

40
Q

Define context-free language?

A

is a formal system that is used to describe a language where the syntax is complex.

Have an infinite range of components, they are used in parsing and logical syntactic analysis.

41
Q

Define Backus-Naur form (BNF)?

A

Is a notation that is used to describe the syntax or grammar used within a programming language.

BNF functions use recursive techniques as there is no method available for the program to loop or repeat.

42
Q
What are the 5 notations for BNF?
Syntax elements
<>
\::=
|
[]
{}
A

<> - Enclose a synactic element.
::= - Indicate the definition of a syntactic element.
| - Symbol indicates an OR choice between two syntactic elements.
[] - Enclose an optional part of the rule.
{} - Enclose a content that can be repeated any number of times.

43
Q

Heres some examples of BNF.

A

::= |

::= 0|1|2|3|4|5|6|7|8|9

44
Q

Define syntax diagrams?

A

Are used to give a representation of context-free language, they can be used to display BNF syntax and rules by an alternative graphical method.

45
Q

What 2 factors determine the efficiency of an algorithm?

A

Time complexity - the amount of time taken to process the task.

Space capacity - the amount of memory or space that is used to process the task.

46
Q

Define Big-O notation?

A

Used to determine the time complexity or run-time of the code as the volume of input data increases.

Input size (N) of the algorithm is used in Big-O notation.

Constant, linear, polynomial, exponential, logarithmic

47
Q

What are the 6 notations for Big-O notation?

A
O(1)
O(LogN)
O(N)
O(N LogN)
O(N^K)
O(K^N)
48
Q

Define tractable?

A

Problems can be solved in a reasonable time frame, they have a polynomial-time solution that can be solved practically using a computer.

49
Q

Define intractable?

A

Problems cannot be solved in a reasonable time frame, they do not have a polynomial-time solution and so cannot be solved practically using a computer.

50
Q

Define heuristics?

A

Is a technique designed to solve a problem based on experience or an ‘educated guess’,
It may not produce an exact solution but are used to tackle intractable problems.

51
Q

Define computable?

A

Computable problems are problems that have an effective procedure or algorithm to solve them.

A program containing a finite set of instructions is executed to determine the correct output for a given input.

52
Q

Define non-computable?

A

Noon-computable problems are problems that have no effective procedure or algorithm to solve them.

These problems are unsolved irrespective of the amount of computer power available or the time allocated to solve them.

53
Q

Define halting problem?

A

Is used to determine whether it is possible to create a program to determine whether a program given an associated input will halt when executed with that input or will it continue forever.

54
Q

Define the Turing machine?

A

Is a machine that controls an infinitely long read/write tape which can be used as an input device, and an infinitely long storage device.

55
Q

What does the start and halt state on the Turing machine do?

A

Start - Start state is the initial state of a Turing machine.
Halt - Halt state is the point at which a Turing machine stops processing

56
Q

Define transition function for the Turing machine?

A

Is a set of rules to indicate how a Turing machine moves between states and how the related tape data changes.

57
Q

Define a universal machine?

A

Is a machine that simulates a Turing machine by reading a description of the functionality of the machine and the inputs associated with it.

It combines a range of individual machines, allowing the option to perform complex calculations.