SDD - Data Structures Flashcards

1
Q

Explain what a 2-D array is…

A

A 2-D array is an array of arrays, it stores data in a grid form, with columns and rows to identify each item in the 2-D array. All the data in the 2-D array is of the same data type.

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

Name and describe the two types of errors in a Stack…

A

Stack Overflow - When you try to ‘push’ an item on to an already full Stack.

Stack Underflow - When you try to ‘pop’ an item from an empty Stack.

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

Explain what a Stack is…

A

A Stack operates under the structure LIFO (Last in first out), which means it always deletes and adds items to the very top of the Stack. The data stored in a Stack is all of the same data type. A variable is kept which holds the value of the index of the top item of the Stack.

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

Explain what a Queue is…

A

A Queue operates under the structure FIFIO (First in first out), so it deletes items from the front and adds to the back. The data is all of the same data type. Two variables are kept which store the index of the front and back of the queue.

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

Describe what happens to the front and back variables for a queue as items are deleted and added…

A

The front of the queue increases by one when you delete an item (So that it shows the next item in the queue) and when items are added the back increases by one (Because a new item has joined the back of the queue).

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

What happens when the items in a queue reach the very end of the queue?

A

If the is space at the very front of the Queue, the Queue becomes a circular Queue, and the back variable goes the the first index. The Queue can then stay like this or if the programmer want, they can shuffle the Queue back into place.

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