Section 2 Flashcards

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

What is the difference between a static data structure and a dynamic one, and give an example of both

A

static is fixed in size(array) and a dynamic one changes in size (tree, list, stack, queue)

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

what advantage is there of a static data structure

A

faster

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

What is FIFO and what is LIFO

A

First in first out

Last in first out

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

What is a data strucutre

A

A way of storing data so that it can be used efficiently

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

what is an array

A

a data structure that has numerous elements, usually of the same type, that are identified by an index

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

What is a 2D array?

A

An array is an indexed set of elements. If each element is itself an array

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

What does the pop operation do in a stack

A

returns the most recent element added to the stack and removes it from the stack

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

What does the push operation in a stack

A

adds an element to the top of the stack

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

What does the peep operation in a stack

A

returnsreturns the most recent element added to the stack but keeps it on the stack

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

what is the difference between a graph and a tree

A

a graph has a loop or a cycle

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

what is a dictionary

A

an abstract data type that has key: value pairs.

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

What makes a tree a “binary tree”

A

Each node has a maximum or 2 children

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

what is a lead of a tree

A

a node that has no children

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

what is the root of a tree

A

a node that is considered the root and every element is directed away from it

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

what makes a tree an ordered binary tree

A

each item on the left or a node should be lower than the value in that node

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