      "collapsed": false
     },
     "outputs": [],
     "source": [
      "def selection_sort(data, start=0):\n",
      "    if start < len(data) - 1:\n",
      "        swap(data, start, find_min_index(data, start))\n",
      "        selection_sort(data, start+1)"
     ]
    },
    {
     "cell_type": "code",
     "execution_count": 3,
 
</s> remove    "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
 </s> add    "cell_type": "markdown",
   "metadata": {}, </s> remove     "def selection_sort_iterative(data):\n",
 </s> add     "def find_min_index(data, start):\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",
    "    if (i != j):\n",
    "        data[i], data[j] = data[j], data[i]\n",
    "\n",
    "\n",
    "def selection_sort_recursive(data, start=0):\n",
    "    if data is None:\n",
    "        return None\n",
    "    if start < len(data) - 1:\n",
    "        swap(data, start, find_min_index(data, start))\n",
    "        selection_sort_recursive(data, start+1)\n",
    "\n",
    "\n",
    "def selection_sort_iterative_alt(data):\n",
    "    if data is None:\n",
    "        return None\n", </s> remove     "collapsed": false
 </s> add     "collapsed": true </s> remove    "execution_count": 3,
 </s> add    "execution_count": 2, </s> remove     "def find_min_index(data, start):\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",
    "    if (i != j):\n",
    "        data[i], data[j] = data[j], data[i]"
 </s> add     "def selection_sort(data):\n",
    "    if data is None:\n",
    "        return\n",
    "    size = len(data)\n",
    "    for i in range(size):\n",
    "        if i == size - 1:\n",
    "            break\n",
    "        min_index = i\n",
    "        for j in range(i + 1, size):\n",
    "            if data[j] < data[min_index]:\n",
    "                min_index = j\n",
    "        data[i], data[min_index] = data[min_index], data[i]"
    "Below are alternate solutions with helper functions:"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "Below are alternate solutions with helper functions:"
    "Below are alternate solutions with helper functions:"
    "Below are alternate solutions with helper functions:"
    "Below are alternate solutions with helper functions:"
     ]
    },
    {
     "cell_type": "code",
     "execution_count": 3,
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Polish selection sort challenge and solution 
sorting_searching/selection_sort/selection_sort_solution.ipynb