{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Theory of computation (C4) Flashcards

(22 cards)

1
Q

Describe the halting problem and state why it is not possible to create a Turing machine which solves it?

A
  • Whether it’s possible or not to determine if a program without running the problem.
  • The halting problem is non-computable, no algorithm can solve it.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Characteristics of finite state machines

A
  • They have a start node, denoted by an arrow coming from nowhere.
  • One or more states can be an accept state, denoted by a double circle.
  • States are joined by transitions, represented by arrows.
  • Each transitional arrow must have a transition condition.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a mealy machine?

A
  • A finite state machine with an output.
  • Output determined by current state/input.
  • Same other rules as FSM (one possible transition).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Big O notation?

A

A way of classifying how quickly an algorithm runs and how much memory it takes up in relation to its input (n).

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

What is an algorithms complexity?

A
  • How quickly the algorithm runs and how much memory it takes up, and how they grow as the size of the input increases.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the permutation of a set of objects?

A
  • The number of ways you can arrange those objects (factorial).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the different Big O complexities?

A
  • O(1): Constant
  • O(log n): Logarithmic
  • O(n): Linear
  • O(n²): Polynomial
  • O(2ⁿ): Exponential
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe the complexity of:
Constant
Log
Linear
Polynomial
Exponential

A
  • Constant: Regardless of dataset, executes in same time. Best case.
  • Logarithmic: Halves dataset in each pass, opposite to exponential, efficient with large datasets, good overall.
  • Linear: Performance is proportional to size of dataset, decent.
  • Polynomial: Performance proportional to the square of the side of dataset. Significantly decreasing efficiency with increasing size of dataset. Poor.
  • Exponential: Doubles with each addition to the dataset in each pass. Opposite of logarithmic, extremely inefficient, worst type.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the complexity of an algorithm with a nested for loop for a 2D array?

A
  • O(n²): Polynomial or quadratic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe linear search and its Big O

A
  • Inefficient for large lists, efficient on smaller datasets.
  • Works on unordered data.
  • Time complexity: O(n)
  • Space complexity O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe binary search and its efficiency

A
  • Requires dataset to be ordered.
  • Effective for large lists.
  • Time complexity: O(log n)
  • Space complexity: O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Efficiency of bubble sort

A
  • Usually O(n²): Polynomial
  • Time complexity: O(n)
  • Space complexity: O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Efficiency of merge sort

A
  • Time complexity: O(n log n)
  • Space complexity: O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain what a turing machine is and define it.

A
  • A theoretical finite state machine with the ability to read/write to an infinite tape.
  • Tape contains an infinite number of cells, and is the memory.
  • The acceptable symbols are known as the alphabet.
  • There must be a read/write head.
  • The machine can halt at any point if it reaches the halting state or all input is processed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What things do you need to represent a program in a turing machine?

A
  • A finite set of states
  • A start state
  • A tape
  • Read/write head
  • Halting states
  • Current state
  • An alphabet
  • A set of transition rules
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a universal turing machine?

A
  • A turing machine which has the ability to execute the behaviour of any other turing machine
  • Instructions and input for the turning machine are stored on the universal turing machines tape.
17
Q

Name 3 things which affect an algorithms Big O

A
  • Number of loops
  • Recursion Depth
  • Input size
18
Q

Why are turing machines more powerful than any computer you can purchase?

A
  • They have unlimited memory
19
Q

What is representational abstraction?

A

Removing unnecessary details from a problem to make it simpler to solve.

20
Q

What is abstraction by generalisation?

A

Group data by common characteristics to form a hierarchal ‘kind-of’ relationship.

21
Q

What is the purpose of the end state in turing machines?

A

Move the read/write head back to the start state.

22
Q

Define algorithm

A

A specific sequence of steps which can be followed to complete a task and that always terminates.