4.2.1 Data Structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How many pointers do linear queues have?

A

Two: Front and Rear Pointer

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

How would this linear queue of size 5 look like after the .dequeue() function is applied. Rear pointer is at position 2 and the front pointer is at 0.

  1. Jack 1.Emily 2.____3._____4._____
A

The rear pointer would remain where it is the front pointer would be moved to position 1 and “Jack” is removed from the queue.

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

FIFO? Example?

A
  1. First in First Out
  2. Queues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What data structures do linear queues use primarily?

A

Arrays

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

What is an ADT give 2 examples?

A
  1. Abstract Data Types
  2. Stacks
    3.Queues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

FILO? Example?

A
  1. First in, Last out
  2. Stacks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define “Abstract Data Types”

A

ADTs are data structures that don’t exist as a data structure but make use of other data structures such as an array or linked list to form a new way of storing data.

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

Define “Array”

A

A finite indexed set of related elements which have the same data type.

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

How does a Circular queue deal with the enqueue() function when the front pointer is in position 0 with the size of the array being 5.

A

When the front pointer is at 0 and the enqueue function is used the front pointer will loop round to the end of the queue at position 4 making that the new start of the queue and adding the person in there.

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

If two items in a priority queue have the same priority what order are they removed in?

A

First in First out (FIFO)

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

Describe a tree data structure.

A

All nodes stem from one root node.

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

a = [4, 5]
b = [5, 3]
What is a.b?

A

a.b is (4x5)+(5x3)
→ (20)+(15)
→ 35

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

What is the name of the procedure that adds an item to a stack? Describe the process?

A

Push
Push adds the new value onto the top of a stack think of this like adding another pancake onto a “stack” of pancakes

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

What is the name of the procedure that removes an item to a stack? Describe the process?

A

Pop
Empties and if top pointer = -1 then it returns stack empty

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

How many pointers do stacks have?

A

One : Top pointer

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

What is better for dense graphs: Adjacency matrices or Adjacency lists?

A

Adjacency Matrices

17
Q

What is meant by a tree?

A

A connected, undirected graphs with no cycles.

18
Q

What is a leaf node?

A

A Leaf node is a node which has no further branches from it.

19
Q

If viewed as a list of numbers, which data structure can be viewed as a vector?

A

A One-Dimensional Array

20
Q

What is said two occur when two values produce the same hash?

A

Collision

21
Q

What is a dictionary?

A

A collection of key value points

22
Q

Which type of data structures are fixed in size? Give an example?

A

Static data structures
Array

23
Q

How is translation of vectors achieved?

A

Vector Addition