1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # SY 301 Fall 2016 # Lab 4: Linked Lists with Recursion # YOUR NAME HERE class Node: def __init__(self, data): self.data = data self.nextNode = None class LinkedList: def __init__(self): """Creates a new LinkedList with nothing in it.""" pass def add_front(self, item): """Inserts the given item at the beginning of the list.""" pass def print_forward(self): """Prints the list items, one per line, in order.""" pass def print_reverse(self): """Prints out the list items, one per line, in reverse order.""" pass def contains(self, needle): """Returns True/False depending on whether the given needle is equal to any of the data items in the list.""" pass def get(self, index): """Returns the data at the given index in the list.""" pass def insert(self, index, item): """Inserts the given item before the one at the given index. For example, calling L.insert(2,4) on list [1,3,5] would result in the list changing to [1,3,4,5].""" pass def add_ordered(self, item): """Inserts the given item into the list so that the list stays in sorted order. Assume the list is already sorted to begin with.""" pass def remove(self, index): """Removes (but does NOT return) the item at the given index.""" pass def size(self): """Returns the number of items in the list.""" pass |