Skip to content

Commit 0ea8db9

Browse files
committed
Merge Sort
1 parent 8225fc9 commit 0ea8db9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Sorting/MergeSort.ipynb

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "markdown",
4+
"cell_type": "code",
5+
"execution_count": 9,
56
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdin",
10+
"output_type": "stream",
11+
"text": [
12+
"Enter the list of numbers: 5 6 3 5 2 1\n"
13+
]
14+
},
15+
{
16+
"name": "stdout",
17+
"output_type": "stream",
18+
"text": [
19+
"Sorted list: [1, 2, 3, 5, 5, 6]\n"
20+
]
21+
}
22+
],
623
"source": [
724
"def merge_sort(alist, start, end):\n",
8-
" '''Sorts the list from indexes start to end - 1 inclusive.'''\n",
925
" if end - start > 1:\n",
1026
" mid = (start + end)//2\n",
1127
" merge_sort(alist, start, mid)\n",

0 commit comments

Comments
 (0)