Data structures - just definitions Flashcards

1
Q

What is a list
Can you create your list on the same line you declare it?

A

Add remove from beginning or end

No index

front()
back()

YES

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

What is a stack
Can you create your list on the same line you declare it?

A

LIFO
.push()
.top()

Not indexed

NO

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

What is a queue

Can you create your list on the same line you declare it?

A

FIFO
Not indexed
.push()
.front()
.back()
.pop()

NO

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

What is a deque

Can you create your list on the same line you declare it?

A

Can add and remove from both ends
indexed
push_front()
push_back()
cars.at(2) = “thing”
insert here as well
YES

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

What is a set

Can you create your list on the same line you declare it?

A

No repeated keys
Not indexed
Ascending order
1234
abcde
.insert()
.erase()

YES

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

What is a map

Can you create your list on the same line you declare it?

A

Dictionary

people[‘jenny’] = 22;
people.insert({‘jenny’, 22})

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

What is a vector

Can you create your list on the same line you declare it?

A

Indexed
dynamic

YES

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

What data structures can your create on the same line that you declare them?

A

list, deque, set, map, vector

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

What data structures do you have to declare before adding elements?

A

stack, queue

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

What data structures do you have to use .push() with and which one can you choose to use it with

A

stack, queue, vector (vector has a push and an insert for the front)
deque

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

What data structures are indexed?

A

vector
deque

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

What data structures are not indexed

A

list
stack
queue
set
map

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