Get the Prep Code from Class here

Get the Github Classroom Assignment Here

Lab 7 - Linked Lists!

We now have an alternative to arrays: the linked-list. We’ll get warmed up in class and then in lab you’ll try to tackle a few basics with simple lists before we look at using the linked-list data structure to implement things like stacks and queues.

Some words of advice: Start each problem by drawing pictures and thinking through it visually. Then code up your pictures as test cases. Once that’s done, get cracking on the code itself. Linked-list programming can be disoriented and working visually and translating your images to code will help get your footing. Finally, remember that Nodes are not values; you’ll do a lot more of L.element and L.next then L.

Problems

A Node definition and stubs have been provided in lab7.py. Refer to the text for problem descriptions. Note some problems are specific about using recursion.

  1. R-7.1
  2. R-7.2
  3. R-7.3
  4. C-7.28