Linked List Flashcards

1
Q

What is Linked List?

A
  • Like Stack, Linked List also uses LIFO- Last in First out method
  • nodes are added and deleted from the same end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can you do random searching?

A

No, we don’t have random access like an array. So, we start at the head node and iterate through each node until we find it or reach the end of the list.

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

What is the time complexity?

A

In worst case scenario, the Time complexity is O(n) and n is the number of items in the list.

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

two primary methods

A

push, pop

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

helper methods

A

index(), remove(), false(bool)=isEmpty

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

What is doubly linked list good for?

A

to remove nodes as they provide access to the previous and the next nodes.

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

How to remove an item in singly linked list?

A

iterate through the list and keep track of the previous node

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