      "class TestSelectionSort(object):\n",
      "\n",
      "    def test_selection_sort(self, func):\n",
      "        print('Empty input')\n",
      "        data = []\n",
      "        func(data)\n",
      "        assert_equal(data, [])\n",
      "\n",
      "        print('One element')\n",
 
</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     "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]" </s> remove     "        test.test_selection_sort(selection_sort_iterative)\n",
 </s> add     "        test.test_selection_sort(selection_sort_recursive)\n",
    "        test.test_selection_sort(selection_sort_iterative_alt)\n",
    "        print('None input')\n",
    "        data = None\n",
    "        func(data)\n",
    "        assert_equal(data, None)\n",
    "\n",
      "class TestSelectionSort(object):\n",
      "\n",
      "    def test_selection_sort(self, func):\n",
    "        print('None input')\n",
    "        data = None\n",
    "        func(data)\n",
    "        assert_equal(data, None)\n",
    "\n",
      "        print('Empty input')\n",
      "        data = []\n",
      "        func(data)\n",
      "        assert_equal(data, [])\n",
      "\n",
      "        print('One element')\n",
keep keep add keep keep keep keep keep keep
 Polish selection sort challenge and solution 
sorting_searching/selection_sort/selection_sort_challenge.ipynb