1.4.2 Flashcards

1
Q

stacks

A

A data structure that operates on a first in last out basis.

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

queues

A

A data structure that is first in first out

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

array

A

a data structure that holds multiple pieces of data within a single identifier.

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

records

A

 Can store multiple values under one identifier
 The data can be of different data types

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

Describe how a 1D array can be set up and used to push and pop items as a stack

A

Array size defined
 A stack pointer is used to point to the top of the stack
 When an item is pushed the stack pointer is incremented
 When an item is popped the stack pointer is decremented

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

Describe the decision that needs to be made in each sub-program and how this impacts
the next process.
push()
pop()

A

 Check if the stack is full (pointer = array.length/array.length+1)
 If it is not – insert the item
 If it is – return/error that the stack is full

 Check if the stack is empty (pointer = 0/1)
 If it is – return/error that the stack is empty
 If it is not – return the item

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

Explain the similarities and differences between a record and a class

A

Record is a data structure…
 …A class is a template for making data structures (objects)
 Class also has methods (which describes functionality)
 Both store data of different types
 Which can be accessed by their names
 But classes can make them accessible via methods
 Both can have multiple ‘instances’
 Class can include visibility of properties / private

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