Data Types and Structures Flashcards Preview

AH Computing > Data Types and Structures > Flashcards

Flashcards in Data Types and Structures Deck (22):
1

Describe a 1D array

Data structure which contains as set of variables of the same data type
Position is stored using an integer index

2

What is a 2D array?

An array of arrays

3

What is the difference between an array and a linked list?

Array - items organised sequentially
Linked List - items organised sequentially, but each item contains a link to next item

4

Give two advantages of linked lists

Dynamic Data structure, can grow and shrink
Very flexible, order of items can be changed without moving data
More memory efficent

5

Give a disadvantage of a linked list

Not possible to identify a specific item directly using its index

6

Give an example of a dynamic data structure which linked lists are used to implement

Queues
Stacks

7

Why is it inefficient to to resize an array in the middle of execution?

Array has to be copied into new memory to accommodate the extra added items
Double array in memory

8

What is a stack?

A stack is a data structure which behaves like a vertical list
Elements can be added or deleted from the top of the stack
'Last in, First out'

9

In what situation would a stack be useful?

Situation which calls for the most recent items to be accessed
Store code produced during compilation of high level languages
Intermediate results of calculations

10

If you have a stack overflow error on a computer what does this mean?

Program has attempted to place too many items on the stack

11

Describe a queue

1D array or list, items are inserted and retrieved at different ends
'First in, First Out'

12

Identify three variables required for implementation of a stack

Stack Pointer
Maximum stack size
An array

13

How can a 2D array be accessed?

Nested loops
(Two fixed loops)

14

Describe a linked last

Dynamic data structure where data items have a link to the next item in the list

15

Describe a record

Data structure consisting of several variables of different types

16

Describe situations where queues are useful to implement

- multiple printing jobs have to be processed
- scheduling of tasks in a multitasking environment.
- event-driven languages where events are placed in a queuing system to wait being processed

17

What is a circular queue?

A queue which uses a system where only the start and end pointers move, allowing the array to behave as if its spaces were arranged in a circle.

18

Where will a link to the last data item point to?

NULL

19

How many pointers does a queue usually need?

2

20

What is a dynamic data structure?

Data structure that can grow or shrink during execution

21

What are two advantages of a 1D array over a 2D array?

- Allows different data types
- More memory efficient if stored in suitable data type

22

A call stack is a stack data structure used to keep track of the active subprograms.
Explain the role of a stack data structure in the execution of this search procedure

Whenever the search procedure is
called, it is added to the call stack
When the base case is reached, the
last procedure call added to the
stack is removed and value is
passed to the previous procedure
call. This repeats until the first
procedure call is reached and a
value is returned