

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 7
click for more info
Not enough gems
Cost: 6 gems
1: Linked Lists
incomplete
2: Linked List vs. List
incomplete
3: Generators
incomplete
4: Iterating
incomplete
5: Add to Tail
incomplete
6: Add to Head
incomplete
7: Linked List Queue
incomplete
8: Remove from Head
incomplete
9: Linked List Queue Quiz
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We're one method away from having a fully functioning O(1) Queue! We just need a way to remove the first element from the linked list in constant time. When we're finished, our LinkedList will fulfill the basic requirements of a Queue:
add_to_tail: Constant time insertremove_from_head: Constant time popLet's rename the LinkedList class to LLQueue and remove the add_to_head functionality because Queues don't allow inserting into the wrong end.
We've also flipped the arrows in the printed representation to reflect the change.
Complete the remove_from_head method. It should remove the first node from the list (the head) and return it.