diff --git a/stacks_queues/queue_list/queue_list_challenge.ipynb b/stacks_queues/queue_list/queue_list_challenge.ipynb index 0e8f0a1..a93acdb 100644 --- a/stacks_queues/queue_list/queue_list_challenge.ipynb +++ b/stacks_queues/queue_list/queue_list_challenge.ipynb @@ -39,7 +39,7 @@ "\n", "* If there is one item in the list, do you expect the first and last pointers to both point to it?\n", " * Yes\n", - "* If there are no items on the list, do you expect the first and last pointers to be NULL?\n", + "* If there are no items on the list, do you expect the first and last pointers to be None?\n", " * Yes\n", "* If you dequeue on an empty queue, does that return None?\n", " * Yes" @@ -90,39 +90,22 @@ "class Node(object):\n", " \n", " def __init__(self, data):\n", - " self.data = data\n", - " self.next = None\n", + " # TODO: Implement me\n", + " pass\n", "\n", "class Queue(object):\n", " \n", " def __init__(self):\n", - " self.first = None\n", - " self.last = None\n", + " # TODO: Implement me\n", + " pass\n", "\n", " def enqueue(self, data):\n", - " node = Node(data)\n", - " if self.first is None and self.last is None:\n", - " self.first = node\n", - " self.last = node\n", - " else:\n", - " self.last.next = node\n", - " self.last = node\n", + " # TODO: Implement me\n", + " pass\n", "\n", " def dequeue(self):\n", - " # Empty list\n", - " if self.first is None and self.last is None:\n", - " return None\n", - " \n", - " # Remove only element from a one element list\n", - " elif self.first == self.last:\n", - " data = self.first.data\n", - " self.first = None\n", - " self.last = None\n", - " return data\n", - " else:\n", - " data = self.first.data\n", - " self.first = self.first.next\n", - " return data" + " # TODO: Implement me\n", + " pass" ] }, { diff --git a/stacks_queues/queue_list/queue_list_solution.ipynb b/stacks_queues/queue_list/queue_list_solution.ipynb index 4d5975f..ae9dd72 100644 --- a/stacks_queues/queue_list/queue_list_solution.ipynb +++ b/stacks_queues/queue_list/queue_list_solution.ipynb @@ -38,7 +38,7 @@ "\n", "* If there is one item in the list, do you expect the first and last pointers to both point to it?\n", " * Yes\n", - "* If there are no items on the list, do you expect the first and last pointers to be NULL?\n", + "* If there are no items on the list, do you expect the first and last pointers to be None?\n", " * Yes\n", "* If you dequeue on an empty queue, does that return None?\n", " * Yes" @@ -79,10 +79,10 @@ "\n", "### Dequeue\n", "\n", - "* If the list is empty, return NULL\n", + "* If the list is empty, return None\n", "* If the list has one node\n", " * Save the first node's value\n", - " * Set first and last to NULL\n", + " * Set first and last to None\n", " * Return the saved value\n", "* Else\n", " * Save the first node's value\n",