U301 SAC Notes Flashcards

1
Q

Define ADTS

A

An abstract data type is a data structure and its allowable operations

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

Define sets

A

A collection of unordered and unique elements

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

Define arrays

A

A collection of elements of the same data type and a fixed length

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

Define lists

A

A collection of elements of any data type and a variable length (able to be appended or removed)

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

What are primitive operations?

A

Operations that
create, destroy, inspect, observe, or change the data structure

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

What are dictionaries

A

Unordered collection of {key,value} pairs, where the key is unique

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

What is a linked list?

A

A sequential access data structure, where each element can be accessed only in particular order.

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

What is a data structure and why are they useful?

A

A data structure is a particular way of organising the data so that it can be used efficiently. They provide a means to managing large amounts of data efficiently through algorithms.

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

What is an ADT

A

Combination of a data structure and its allowable operations

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

What does contiguous mean?

A

Adjacent to, neighbouring, touching

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

What is the role of arrays in data modelling?

A

They provide efficient access to elements by index, making them suitable for scenarios where fast random access is required.
They are useful for modelling fixed size elements, such as a book with its fixed number of pages. Other examples include coordinates

However, their fixed size is not suitable for situations where the size of the data can be changing/large

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

Role of lists in data modelling

A

Since arrays are not suitable for when the size of the data may be changing, lists allow for efficient insertion and removal of elements, making them useful for
1) task management
2) scheduling,
3) data processing
They are also used to model collections of similar information (such as friends invited for a party)

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

Roles of Sets in data modelling

A

They are useful when collecting SIMILAR unique objects, such as {Monday, Tuesday, wednesday} however they don’t allow for duplicate items

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

Roles of Dictionaries in data modelling

A
  • They store key-value pairs, allowing efficient retrieval of values based on keys. They provide operations for insertion, deletion, and retrieval based on keys.
  • If you need to quickly retrieve values based on known keys without iterating through the entire collection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Roles of Queues & Priority queues in data modelling

A

As they use the FIFO principle, they are particularly useful when we want the elements in a specific order. They are used largely in scheduling problems and project management.

Priority queues are used in hospitals (based of patient condition), or a airport runway

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

Roles of Graphs in data modelling

A

Graphs are used for modelling complex relationships, or connections between specific nodes and edges, such as social networks and organisational structures.

17
Q

What is meant by modularising algorithms?

A

Grouping part of the algorithm into smaller algorithms (modules)

18
Q

Advantages of modularising algorithms

A
  • Re-use modules in other places
  • Easier to rewrite the modules
  • Use a function before you have defined it
19
Q

What is top-down design?

A

Breaking the problem down into smaller parts
- Vision → Design → Develop

20
Q

Advantages of Top-down design:

A

-Breaking down the problem helps clarify the problem
- At each step of refinement, the new parts become easier to figure out
- Reusable parts
- Allows more than one person to work on the solution

21
Q

What principle do stacks use?

A

LIFO (last in, first out) or (FILO), just think of stack of plates for dishwashing

22
Q

What is morse code?

A

Morse code is a method that is used to encode letters of the alphabet, numbers, and punctuation marks as arrangements/sequences of 2 different “signals”, known as “dots” and “dashes”

23
Q

For real-world problems, what ADT should you use when the number of items is fixed?

A

Arrays, and if it isn’t fixed then Lists

24
Q

For real-world problems, what ADT should you use when the order of the items doesn’t matter?

A

A Set

25
Q

Define Paths

A

Sequences of vertices that are connected so that we can move from A to B

26
Q

Define forests

A

A graph that has no cycles but is not necessarily connected

27
Q

What are simple graphs?

A

Only have a single edge between any pair of vertices and no loops

28
Q

What are circuits?

A

A graph contains a circuit if there is more than one path that connects two nodes

29
Q

What are walks?

A

A walk is a sequence of edges, each edge connecting successive nodes

30
Q

What are trails?

A

A trail is a walk with no repeated edges.

31
Q

What is a cycle

A

A path that starts and ends on the same node

32
Q

What is a binary search tree?

A

A binary tree where every node in the left subtree is less than the root, and every node in the right subtree is greater than the root

33
Q

How does insertion work in a binary search tree

A

The new element is compared with the current node’s value. If the element is less than the node’s value, it is inserted to the left of the subtree, if it is greater, it is inserted to the right