4. Theory of Computation Flashcards

1
Q

What is an Algorithm?

A

An Algorithm is a sequence of steps to solve a problem

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

What is Assignment?

A

Assignment is when a value is given to a Variable.

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

What do Sequence, Selection and Iteration refer to?

A

Sequence - code is executed line by line from the top of the program to the end.
Selection - a choice is made between different possibilities, for example with an IF-statement.
Iteration - code is repeated using a loop structure, for example a FOR or WHILE loop.

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

What is Representational Abstraction?

A

Representational Abstraction is the removal of detail from a problem until only the details required to solve the problem computationally remain.

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

What is Abstraction by Generalisation?

A

Abstraction by Generalisation is the grouping of common characteristics until a problem can be related (“is a kind of”) to a structure with known behaviour (such as a graph).

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

What is Procedural Abstraction?

A

Procedural Abstraction is the use of Procedures/Subroutines which solve a group of similar problems. Specific problems can be solved by specifying different inputs to the Procedure.

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

What is Functional Abstraction?

A

Functional Abstraction is the use of Functions which map a set of inputs to a set of outputs, this is independent of how that mapping is computed.

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

What is Data Abstraction?

A

Data Abstraction is the use of Abstract Data Types to structure data in the solution of a problem. An Abstract Data Type defines how its contents can be manipulated, but now how that behaviour is implemented. For example, a Stack Data Structure allows elements to be added (pushed) on to its top, or removed (popped) from its top, but could be implemented in several different ways (e.g. using an Array or a Linked List).

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

What is Problem Abstraction?

A

Problem Abstraction is the removal of details from a problem until it reduces to an already solved problem with known properties.

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

What is Decomposition/Composition?

A

Decomposition is the breaking a complex task into multiple sub-tasks which are simpler to solve. Composition is combining the solutions to simple tasks to solve a larger more complex task.

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

What is Automation?

A

Automation is when a model of a real world process is used to generate actions which in turn affect that real world process. For example Climate Models can be used to predict the effect of various policy choices, which could then be used to decide what policy to put into action.

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

What is Time Complexity, and what does n refer to in Big O notation?

A

Time Complexity is a way of describing how efficient an Algorithm is (or how difficult a problem is). It relates the time taken to solve a problem to the size of that problem. In Big O notation, n refers to the size of the problem. This may mean a different thing in different circumstances - it could be the size of a number, the length of an Array, or the number of nodes in a Graph, amongst many other possibilities.

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

Put the following Time Complexities in Order:
O(n^2), O(log n), O(1), O(2^n), O(n)

A

O(1) < O(log n) < O(n) < O(n^2) < O(2^n)
Constant < Logarithmic < Linear < Polynomial < Exponential

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

Identify the Time Complexities of the following Algorithms:
Bubble Sort,
Linear Search,
Merge Sort,
Binary Search

A

Bubble Sort is O(n^2)
Linear Search is O(n)
Merge Sort is O(n log n)
Binary Search is O(log n)

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

What is the difference between Tractable and Intractable problems?

A

Tractable problems can be solved in Polynomial Time, whereas Intractable problems cannot. Tractable problems are generally well-behaved for modern computers, whereas Intractable problems grow too quickly to solve large problems.

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

What is a Heuristic and when would you use one?

A

A Heuristic is an assumption which simplifies a problem such that it is quicker to solve. A Heuristic may make it quicker to get a solution, but does not guarantee that you get the correct solution.

A Heuristic would be used to simplify an Intractable problem so that it behaves like a Tractable one, and allows bigger problems to be solved.

17
Q

What is the difference between Computable and Non-Computable problems?

A

Computable problems can be solved by computers, but may take a long time to solve (i.e. Intractable). Non-Computable problems cannot be solved by a computer no matter how long you wait.

18
Q

Identify whether the following problems are Tractable, Intractable, or Non-Computable:

Searching a Binary Search Tree
The Travelling Salesman Problem
Searching an Array
The Halting Problem
Sorting a List

A

Searching a Binary Search Tree - Tractable
The Travelling Salesman Problem - Intractable
Searching an Array - Tractable
The Halting Problem - Non-Computable
Sorting a List - Tractable

19
Q

What is the Halting Problem?

A

The Halting Problem -
Can we write a program, which when given another program and its input, can determine whether or not that program will halt (complete), without running the program?

20
Q

How is a Mealy Machine different from a standard Finite State Machine?

A

A Mealy Machine has outputs associated with each of the transitions between states.

21
Q

What does a Regular Expression allow you to do?

A

A Regular Expression is a string pattern which can be used to match other strings. For example we could create a Regular Expression to tell us whether a string contained an email address or a numberplate.

22
Q

What is a Turing Machine? What does it consist of? And what do each of the components represent?

A

A Turing Machine is a theoretical model of a computer. It consists of an infinitely long string of tape (Main Memory), a read/write head (CPU), and a set of transition functions (the program to execute).

23
Q

What is a Universal Turing Machine?`and what is its significance?

A

A Universal Turing Machine is a Turing Machine where the transition functions for the program are stored on the tape itself. This means that by changing the program on the tape you can change what the machine does. This makes a Universal Turing Machine a model of a General Purpose Computer and is related to the Stored Program Concept.

24
Q

What is the purpose of Backus Naur Form?

A

Backus Naur Form is a way of expressing the syntax rules of a language, for example a programming language.