Exercise 14. Double Linked Lists
The previous exercise may have taken you quite a while to complete since you have to figure out how to make a single linked list work. Hopefully, the video gave you enough information to complete the exercise and also showed you exactly how to do an audit of your code. In this exercise you’re going to implement the better version of linked lists called DoubleLinkedList
.
In the SingleLinkedList
you should have realized that any operation involving the end of the list has to travel through each node until it gets to the end. A SingleLinkedList
is only efficient from the front of the list where you can easily change the next
pointer. The shift
and unshift
operations are fast, but pop
and push
cost you as the list ...
Get Learn More Python 3 the Hard Way: The Next Step for New Python Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.