Data Structure Flashcards

1
Q

What does the acronym LIFO mean?

A

Last in, First Out

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

What methods are available on a Stack data structure?

A

.pop()
.push()
.peek()

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

What must you do to access the value at an arbitrary point in a stack (not just the “top”)?’

A

Use .pop() until you reach the value that you need and put the stack back to where it was

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

How are linked lists different from an array?

A

o You can access items sequentially unlike arrays which can be accessed randomly
o They don’t have indexes
o They’re like nested objects
o Real arrays are continuous chunk of arrays, linked lists are spread out

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

How would you access an arbitrary node in a linked list (not just the “head”)?

A

Keep using .next() until you reach the node you’re looking for

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