wds Flashcards

1
Q

When is adjacency matrix more appropriate to use instead of an adjacency list?

A

When there are more edges between vertices

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

When is adjacency list more appropriate to use instead of an adjacency matrix?

A

When there are few edges between vertices

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

What is a graph?

A

A nonlinear abstract data structure

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

What are two examples of linear data structures?

A

Queue

Stack

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

What are two examples of non-linear data structures?

A

Graph

Tree

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

What does a graph consist of and what can they be used to represent?

A

Consist of vertices and edges

To record relationships between objects

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

What properties must a graph have for it to be a tree?

A
  • No cycles
  • Undirected
  • Connected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where should I place the dot and number to solve a pre-order traversal?

A

On the left and use a dotted line around the outside starting from the root

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

Where should I place the dot and number to solve a In-order traversal?

A

Below - Starting with the left leaf

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

Where should I place the dot and number to solve a post-order traversal?

A

On the right - Starting from the left leaf

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

What can a programmer do to ‘solve’ an intractable problem?

A

An algorithm could make an educated guess based on previous data

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

How can a Universal Turning machine be considered as a interpreter?

A

It reads instructions one at a time and executes the instructions

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

What is representational abstraction?

A

Removing (unnecessary) details;

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

What is abstraction by generalisation?

A

Grouping by common characteristics // a hierarchical / ‘kind-of’ relationship;

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

Explain the circumstances when it would be more appropriate to use an adjacency
matrix instead of an adjacency list.

A

Adjacency matrix appropriate when there are many edges between vertices

When graph/matrix is not sparse;
When edges frequently changed;
When presence/absence of specific edges needs to be tested frequently;

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

What is BNF (Backus-Naur Form)?

A

A formal mathematical way of defining syntax unambiguously

17
Q

Describe the relationship between regular expressions and FSMs.

A

Regular language can be defined as any language that a FSM will accept

18
Q

What is Universal Turing Machine?

A

A Turing machine that can execute the behaviour of any other Turing
machine // can compute any computable sequence

19
Q

What the difference between a local and global variable?

A

Local variables only be accessed in a subroutine of a program whereas global variables can be assessed from any part of the program

20
Q

Why is it good practice to use local variables?

A

Less chance of accidently changing the value of a variable

21
Q

Why is reverse polish notation sometimes used instead of infix notation?

A
  • Simpler for a computer to evaluate

- Doesn’t need brackets

22
Q

Describe the halting problem?

A

Determining if a program will halt without running the program for an particular input

23
Q

Why is it not possible to create a Turing machine that solves the halting problem?

A

The Halting problem is non-computable and there is no algorithm that solves the Halting problem

24
Q

What components must a Turing machine have?

A
  • Read-write head
  • Start state
  • Current state
  • Finite set of states
25
Q

Why is a Turing machine more powerful than any computer?

A

Because it has an infinite amount of memory

26
Q

Why is a circular queue better than a linear queue?

A
  • Linear queues can have wasted space that’s not able to be used
  • To avoid all items being moved forward when an item is deleted from the queue
27
Q

What is meant by recursively-defined?

A

A procedure/ subroutine that can call itself

28
Q

What is the big O notation for Bubble Sort, Merge Sort, Binary Search and Linear Search?

A

O(log n): Binary Search - GOOD
O(n): Linear - DECENT
O(n^2) : Bubble Sort - POOR
O(nlog n): Merge Sort

29
Q

What is the big O notation for bubble sort?

A

O(n^2) : Bubble Sort - POOR

30
Q

What is the big O notation for merge sort?

A

O(nlog n): Merge Sort

31
Q

What is the big O notation for Binary Search?

A

O(log n): Binary Search - GOOD

32
Q

What is the big O notation for Linear Search?

A

O(n): Linear - DECENT

33
Q

What’s the difference between a static and dynamic data structure?

A

-Static data structures have storage size determined before program is
run
-Dynamic data structures can grow/shrink during execution

34
Q

What’s the difference between a protected attribute and a private attribute?

A
A protected attribute can be accessed (within its class and) by derived class instances /
subclasses;
A private attribute can only be accessed within its class;