Skip to content

Latest commit

 

History

History
74 lines (58 loc) · 3.76 KB

File metadata and controls

74 lines (58 loc) · 3.76 KB

Class 4: Arrays & Linked Lists

Minute-by-Minute [OPTIONAL]

NOTE: Fill in with the appropriate items

Elapsed Time Activity
0:00 0:05 Objectives
0:05 0:15 Overview
0:20 0:45 In Class Activity I
1:05 0:10 BREAK
1:15 0:45 In Class Activity II
TOTAL 2:00

Learning Objectives (5 min)

NOTE: Fill in with the appropriate items

By this end of this lesson, students should be able to...

  1. Practice more advanced techniques with lists and arrays
  2. Implement various list manipulation methods such as insert and replace

Topics

Resources

Challenges

  • Add new features to LinkedList class using linked list starter code:
    • Add size property that tracks list length in constant running time
    • Implement get_at_index(index) - returns the item at index in the list
    • Implement insert_at_index(index, item) - inserts item at index (all items after index are moved down)
    • Implement replace(old_item, new_item) - replaces old_item in the list with new_item using the same node
    • Run python linkedlist.py to test LinkedList class instance methods on a small example
    • Run pytest linkedlist_test.py to run the linked list unit tests and fix any failures
  • Annotate methods with complexity analysis of running time and space (memory)

Stretch Challenges

  • Implement DoublyLinkedList class with BinaryNode objects, which have both next and previous properties
  • Write unit tests for to ensure the DoublyLinkedList class is robust
    • Include test cases for each class instance method and property
  • Annotate methods with complexity analysis of running time and space (memory)