mark schemes Flashcards

1
Q

Comparing data structures

A
  • compare static or dynamic (and why this is applicable)
  • compare contiguous memory locations or non-contiguous memory locations (and why this is applicable)
  • compare how and how quickly items are accessed (and why this is applicable)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Binary tree searches

A
  • write comparison
  • write result (go left, go right)
  • repeat
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Data structure definitions

A
  • is static or is dynamic

- how is data held (2 points)

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

Adding Nodes Linked Lists

A
  • new item is placed in address at next free
  • next free is incremented
  • penultimate node’s pointer is adjusted to point to new item’s pointer
  • new item’s pointer is set to null to indicate that it is at the end of the list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Statistic data structure definition

A
  • size is fixed at creation

- size can’t change during processing

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

Dynamic data structure definition

A
  • size can change as needed

- during processing

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

Adjacency List over Matrix

A
  • graph is sparse
  • edges are rarely changed
  • prescence/abscence of specific edges don’t need to be noted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Tree Properties

A
  • connected
  • undirected
  • with no cycles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How a value is stored in a hash table

A
  • hashing algorithm is applied to the key
  • result is the address in which the value is stored
  • in the event of a collision (different keys generating the same address)
  • the value is placed in the next address
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Purpose of rehashing

A
  • large number of possible addresses in a hash table are filled
  • this makes searching and management inefficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Rehashing Steps

A
  • larger hash table is created

- each value in the existing table added to the new table using a hashing algorithm

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

how are collisions resolved

A

item has the same address as _, add one to the address until a free space is found

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

stack for back button

A

-A (data structure) that operates on a first in last out basis
(1)
-When going back a page you want to go back to the last
page visited/when displaying the history we want to start
with the most recent first (1)

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

dynamic data structure - advantages

A

No wasted memory;

Can grow as more data is added to the data structure // no limit on number of
items that can be added (except due to hardware limitations);

Resources only allocated as they are needed (with static data structures they are
allocated at creation even if not needed until later);

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

dynamic data structure - disadvantages

A

Additional memory needed for pointers;

Can result in memory leak (if memory that is no longer needed is not returned to
the heap);

Can take longer to access an item directly (for data structures that allow this);

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

describing adding to (static) queue

A

Check that the queue is not already ful (rear = max)l;

(if it isn’t) then add 1 to the value of the rear pointer;

then add the new item to the position indicated by the rear pointer;

17
Q

describing removing from (static) queue

A

check that the queue is not empty (front = -1)

add 1 to the value of the front/start pointer

return the value at the position indicated by the front pointer - 1

18
Q

adding item priority queue

A

Starting with the item at the rear of the queue move each item back one place in the array;
Until you (reach the start of the queue or) find an item with the same or higher priority than
the item to add;
NE. same priority
NE. higher priority
Add the new item in the position before that item