Topic 2 - Collections Flashcards

1
Q

Give examples of collections.

A

Queue: first item in is first item out e.g. a lineup at a checkout counter
Stack: last item in is first item out
List: we can have ordered or unordered lists

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

Describe linear collections.

A

items are organized in a “straight line”

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

Give an example of a nonlinear collection.

A

Hierarchical collections: trees, graphs

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

Define trees.

A
  • items are ordered in an “upside down tree”
  • each item except the one at the top has a unique predecessor but may have many successors
    examples: taxanomies, computer file systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define: abstraction

A
  • Abstraction separates the purpose of an entity from its implementation
  • provides a way of dealing with the complexity of a large system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are stacks, ques, lists, trees etc?

What are integers, booleans, doubles?

A

Abstract data types.

Data types.

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

Define: data structure

A

A construct within a programming language, used to implement a collection

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

Define: collection

A

a group of items that we wish to treat as a conceptual unit

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

Define: interface of the collection.

A

What we need in order to interact with it ie. the operations on collections

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

Define: implementation of the collection.

A

the underlying details of how it is coded

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

Define Abstract Data Types

A

A collection of data together with the set of operations on that data

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

Define Data Type

A

A set of values and the operations defined on those values ex. integer data types

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

Why are ADTs abstract?

A

Its a data type who’s values and operations are not inherently defined in a programming language

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