Data structures - just definitions Flashcards
What is a list
Can you create your list on the same line you declare it?
Add remove from beginning or end
No index
front()
back()
YES
What is a stack
Can you create your list on the same line you declare it?
LIFO
.push()
.top()
Not indexed
NO
What is a queue
Can you create your list on the same line you declare it?
FIFO
Not indexed
.push()
.front()
.back()
.pop()
NO
What is a deque
Can you create your list on the same line you declare it?
Can add and remove from both ends
indexed
push_front()
push_back()
cars.at(2) = “thing”
insert here as well
YES
What is a set
Can you create your list on the same line you declare it?
No repeated keys
Not indexed
Ascending order
1234
abcde
.insert()
.erase()
YES
What is a map
Can you create your list on the same line you declare it?
Dictionary
people[‘jenny’] = 22;
people.insert({‘jenny’, 22})
What is a vector
Can you create your list on the same line you declare it?
Indexed
dynamic
YES
What data structures can your create on the same line that you declare them?
list, deque, set, map, vector
What data structures do you have to declare before adding elements?
stack, queue
What data structures do you have to use .push() with and which one can you choose to use it with
stack, queue, vector (vector has a push and an insert for the front)
deque
What data structures are indexed?
vector
deque
What data structures are not indexed
list
stack
queue
set
map