      "collapsed": true
     },
     "outputs": [],
     "source": [
      "def selection_sort(data):\n",
      "    if data is None or len(data) < 2:\n",
      "        return\n",
      "    for i in range(len(data)-1):\n",
      "        min_index = i\n",
      "        for j in range(i + 1, len(data)):\n",
      "            if data[j] < data[min_index]:\n",
      "                min_index = j\n",
      "        data[i], data[min_index] = data[min_index], data[i]"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Below are alternate solutions with helper functions:"
     ]
    },
    {
     "cell_type": "code",
     "execution_count": 2,
     "metadata": {
      "collapsed": true
     },
     "outputs": [],
     "source": [
      "def find_min_index(data, start):\n",
      "    # Raises an exception if: \n",
      "    # -data is None\n",
      "    # -start >= len(data) - 1\n",
      "    min_index = start\n",
      "    for i in range(start + 1, len(data)):\n",
      "        if data[i] < data[min_index]:\n",
      "            min_index = i\n",
      "    return min_index\n",
      "\n",
      "\n",
      "def swap(data, i, j):\n",
      "    # Raises an exception if: \n",
      "    # -data is None\n",
 
</s> remove     "def swap(data, i, j):\n",
    "    # Raises an exception if: \n",
    "    # -data is None\n",
    "    # -i or j are >= len(data)\n",
    "    if i != j:\n",
    "        data[i], data[j] = data[j], data[i]\n",
 </s> add     "    def sort_iterative_alt(self, data):\n",
    "        if data is None:\n",
    "            raise TypeError('data cannot be None')\n",
    "        if len(data) < 2:\n",
    "            return data\n",
    "        for i in range(len(data)-1):\n",
    "            self._swap(data, i, self._find_min_index(data, i))\n",
    "        return data\n", </s> remove     "def selection_sort_iterative_alt(data):\n",
    "    if data is None or len(data) < 2:\n",
    "        return\n",
    "    for i in range(len(data)-1):\n",
    "        swap(data, i, find_min_index(data, i))"
 </s> add     "    def _swap(self, data, i, j):\n",
    "        if i != j:\n",
    "            data[i], data[j] = data[j], data[i]\n",
    "        return data" </s> remove     "def selection_sort(data, start=0):\n",
    "    # TODO: Implement me (recursive)\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def selection_sort_iterative(data):\n",
    "    # TODO: Implement me (iterative)\n",
    "    pass"
 </s> add     "class SelectionSort(object):\n",
    "\n",
    "    def sort(self, data):\n",
    "        # TODO: Implement me (recursive)\n",
    "        pass"
    "class SelectionSort(object):\n",
      "collapsed": true
     },
     "outputs": [],
     "source": [
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
    "class SelectionSort(object):\n",
      "\n",
      "\n",
      "def swap(data, i, j):\n",
      "    # Raises an exception if: \n",
      "    # -data is None\n",
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Update selection sort challenge (#131)

Update constraints, test cases, code, and tests. 
sorting_searching/selection_sort/selection_sort_solution.ipynb