Question: # Linked list. The code is given below, please continue with last two functions Our data is ['fish', 'mushroom', 'beef', 'pork', 'carrot', 'cheese', 'butter', 'bread',

# Linked list. The code is given below, please continue with last two functions Our data is ['fish', 'mushroom', 'beef', 'pork', 'carrot', 'cheese', 'butter', 'bread', 'milk', 'banana', 'apple'] # Code class Node: def __init__(self, data=None, next=None): self.data = data self.next = next class LinkedListShoppingListManagerClass: def __init__(self): self.head = None def insert_item(self, data): node = Node(data, self.head) self.head = node def print_items(self): cur = self.head arr = [] while cur: arr.append(str(cur.data)) cur = cur.next print(arr, end=" ") def delete_item(self, data): cur = self.head prev = None if cur is None and cur.data == data: self.head = self.head.next return while cur: if cur.data == data: prev.next = cur.next break prev, cur = cur, cur.next 

def get_last_item(self): # returns the last item name from the linked list.

def find_smallest(self): # returns the smallest item from linked list. (ex. [ apple banana cheese] -> apple is smallest)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!