      "collapsed": false
     },
     "outputs": [],
     "source": [
      "# Test length\n",
      "# Zero elements\n",
      "linked_list = LinkedList(None)\n",
      "print(len(linked_list))\n",
      "# One or more elements\n",
      "head = Node(10)\n",
      "linked_list = LinkedList(head)\n",
      "linked_list.insert_to_front('a')\n",
      "linked_list.insert_to_front('bc')\n",
      "print(len(linked_list))"
     ]
    },
    {
     "cell_type": "code",
     "execution_count": null,
 
</s> remove     "# Test delete\n",
    "# Delete in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.delete('a')\n",
    "linked_list.print_list()\n",
    "# Delete a NULL\n",
    "head = Node(10)\n",
    "linked_list = LinkedList(head)\n",
    "linked_list.delete(None)\n",
    "linked_list.print_list()\n",
    "# Delete in a list with one element or more matching elements\n",
    "head = Node(10)\n",
    "linked_list = LinkedList(head)\n",
    "linked_list.insert_to_front('a')\n",
    "linked_list.insert_to_front('bc')\n",
    "linked_list.delete('a')\n",
    "linked_list.print_list()\n",
    "# Delete in a list with no matches\n",
    "linked_list.delete('aa')"
 </s> add     "## Unit Test" </s> remove     "# Test find\n",
    "# Find in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "node = linked_list.find('a')\n",
    "print(node)\n",
    "# Find a NULL\n",
    "head = Node(10)\n",
    "linked_list = LinkedList(head)\n",
    "node = linked_list.find(None)\n",
    "print(node)\n",
    "# Find in a list with one element or more matching elements\n",
    "head = Node(10)\n",
    "linked_list = LinkedList(head)\n",
    "linked_list.insert_to_front('a')\n",
    "linked_list.insert_to_front('bc')\n",
    "node = linked_list.find('a')\n",
    "print(node)\n",
    "# Find in a list with no matches\n",
    "node = linked_list.find('aaa')\n",
    "print(node)"
 </s> add     "%run linked_list.py" </s> remove    "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
 </s> add    "cell_type": "markdown",
   "metadata": {}, </s> remove     "            curr_node = curr_node.next"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%run linked_list.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Test insert_to_front\n",
    "# Insert in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.insert_to_front(10)\n",
    "linked_list.print_list()\n",
    "# Insert a NULL\n",
    "linked_list.insert_to_front(None)\n",
    "linked_list.print_list()\n",
    "# Insert in a list with one element or more elements\n",
    "linked_list.insert_to_front('a')\n",
    "linked_list.insert_to_front('bc')\n",
    "linked_list.print_list()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Test append\n",
    "# Insert in an empty list\n",
    "linked_list = LinkedList(None)\n",
    "linked_list.append(10)\n",
    "linked_list.print_list()\n",
    "# Insert a NULL\n",
    "linked_list.append(None)\n",
    "linked_list.print_list()\n",
    "# Insert in a list with one element or more elements\n",
    "linked_list.append('a')\n",
    "linked_list.append('bc')\n",
    "linked_list.print_list()"
 </s> add     "            curr_node = curr_node.next\n",
    "\n",
    "    def get_all_data(self):\n",
    "        data = []\n",
    "        curr_node = self.head\n",
    "        while curr_node is not None:\n",
    "            data.append(curr_node.data)\n",
    "            curr_node = curr_node.next\n",
    "        return data" </s> remove    "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
 </s> add    "cell_type": "markdown",
   "metadata": {},
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
    "*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand.  You generally will not be asked to write a unit test like what is shown below.*"
     ]
    },
    {
     "cell_type": "code",
     "execution_count": null,
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Reworked notebook: Added more detail to constraints and test cases.  Reworked algorithm discussion, code, and unit test. 
linked-lists/linked-list.ipynb