Skip to content

Commit

Permalink
corrected few errors and many minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JensLiebehenschel committed Apr 6, 2021
1 parent 72cf9d1 commit 3d3e1a6
Show file tree
Hide file tree
Showing 27 changed files with 409 additions and 256 deletions.
8 changes: 4 additions & 4 deletions Bubblesort/Bubblesort.ipynb
Expand Up @@ -69,7 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
"# The size of elements in tests can be changed here\n",
"# The size of array in tests can be changed here\n",
"ARRAY_SIZE = 10\n",
"# Some output text\n",
"TEXT_BEFORE_SORTING = \"Before sorting:\"\n",
Expand All @@ -88,7 +88,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### bubblesort without termination condition"
"### Bubblesort without termination condition"
]
},
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### bubblesort with termination condition"
"### Bubblesort with termination condition"
]
},
{
Expand Down Expand Up @@ -255,7 +255,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### your tests here ..."
"### Your tests here ..."
]
},
{
Expand Down
31 changes: 15 additions & 16 deletions Bubblesort/BubblesortStatistics.ipynb
Expand Up @@ -36,7 +36,7 @@
" comparison_keys += 1\n",
" if outputStats:\n",
" # output of counters, \"# ...\" means \"number of ...\"\n",
" print(TEXT_SPACING, \"# elements in array =\", len(a))\n",
" print(TEXT_SPACING, \"# keys in array =\", len(a))\n",
" print(TEXT_SPACING, \"# executions outer loop =\", exec_outer_loop)\n",
" print(TEXT_SPACING, \"# executions inner loop =\", exec_inner_loop)\n",
" print(TEXT_SPACING, \"# key comparisons =\", comparison_keys)\n",
Expand Down Expand Up @@ -75,7 +75,7 @@
" break\n",
" if outputStats:\n",
" # output of counters, \"# ...\" means \"number of ...\"\n",
" print(TEXT_SPACING, \"# elements in array =\", len(a))\n",
" print(TEXT_SPACING, \"# keys in array =\", len(a))\n",
" print(TEXT_SPACING, \"# executions outer loop =\", exec_outer_loop)\n",
" print(TEXT_SPACING, \"# executions inner loop =\", exec_inner_loop)\n",
" print(TEXT_SPACING, \"# key comparisons =\", comparison_keys)\n",
Expand All @@ -96,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
"# The size of elements in tests can be changed here\n",
"# The size of array in tests can be changed here\n",
"ARRAY_SIZE = 10\n",
"# Some output text\n",
"TEXT_BEFORE_SORTING = \"Before sorting:\"\n",
Expand All @@ -115,7 +115,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### bubblesort without termination condition"
"### Bubblesort without termination condition"
]
},
{
Expand All @@ -128,7 +128,7 @@
"output_type": "stream",
"text": [
"Before sorting: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 9\n",
" # executions inner loop = 45\n",
" # key comparisons = 45\n",
Expand All @@ -154,7 +154,7 @@
"output_type": "stream",
"text": [
"Before sorting: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 9\n",
" # executions inner loop = 45\n",
" # key comparisons = 45\n",
Expand All @@ -180,7 +180,7 @@
"output_type": "stream",
"text": [
"Before sorting: [2, 8, 4, 9, 1, 6, 7, 3, 0, 5]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 9\n",
" # executions inner loop = 45\n",
" # key comparisons = 45\n",
Expand All @@ -206,7 +206,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### bubblesort with termination condition"
"### Bubblesort with termination condition"
]
},
{
Expand All @@ -219,7 +219,7 @@
"output_type": "stream",
"text": [
"Before sorting: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 1\n",
" # executions inner loop = 9\n",
" # key comparisons = 9\n",
Expand All @@ -245,7 +245,7 @@
"output_type": "stream",
"text": [
"Before sorting: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 9\n",
" # executions inner loop = 45\n",
" # key comparisons = 45\n",
Expand All @@ -271,7 +271,7 @@
"output_type": "stream",
"text": [
"Before sorting: [2, 8, 4, 9, 1, 6, 7, 3, 0, 5]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions outer loop = 8\n",
" # executions inner loop = 44\n",
" # key comparisons = 44\n",
Expand All @@ -294,7 +294,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### your tests here ..."
"### Your tests here ..."
]
},
{
Expand All @@ -307,7 +307,7 @@
"output_type": "stream",
"text": [
"Before sorting: [1, 3, 2]\n",
" # elements in array = 3\n",
" # keys in array = 3\n",
" # executions outer loop = 2\n",
" # executions inner loop = 3\n",
" # key comparisons = 3\n",
Expand All @@ -317,7 +317,6 @@
}
],
"source": [
"# your test here ...\n",
"array = [1,3,2]\n",
"print(TEXT_BEFORE_SORTING, array)\n",
"print(TEXT_AFTER_SORTING, bubblesort(array)[0])"
Expand All @@ -329,7 +328,7 @@
"metadata": {},
"outputs": [],
"source": [
"# ... and here ...\n"
"# ... and here ..."
]
},
{
Expand Down Expand Up @@ -380,7 +379,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### bubblesort with and without termination condition"
"### Bubblesort with and without termination condition"
]
},
{
Expand Down
52 changes: 30 additions & 22 deletions Bubblesort/BubblesortVisualization.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Countingsort/Countingsort.ipynb
Expand Up @@ -21,12 +21,12 @@
" C=[0 for x in range(max(A)+1)]\n",
" print_array_C(C)\n",
"\n",
" # count number of elements = i in C[i]\n",
" # count number of keys = i in C[i]\n",
" for j in range(len(A)):\n",
" C[A[j]] = C[A[j]] + 1\n",
" print_array_C(C)\n",
" \n",
" # calculate number of elements <= i in C[i]\n",
" # calculate number of keys <= i in C[i]\n",
" for i in range(1,len(C)):\n",
" C[i] = C[i] + C[i-1]\n",
" print_array_C(C)\n",
Expand Down Expand Up @@ -78,7 +78,7 @@
"metadata": {},
"outputs": [],
"source": [
"# The size of elements in tests can be changed here\n",
"# The size of array in tests can be changed here\n",
"ARRAY_SIZE = 10\n",
"# Some output text\n",
"TEXT_BEFORE_SORTING = \"Before sorting:\"\n",
Expand Down Expand Up @@ -252,7 +252,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### your tests here ..."
"### Your tests here ..."
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions Heapsort/Heapsort.ipynb
Expand Up @@ -79,7 +79,7 @@
"metadata": {},
"outputs": [],
"source": [
"# The size of elements in tests can be changed here\n",
"# The size of array in tests can be changed here\n",
"ARRAY_SIZE = 10\n",
"# Some output text\n",
"TEXT_BEFORE_SORTING = \"Before sorting:\"\n",
Expand Down Expand Up @@ -176,7 +176,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### your tests here ..."
"### Your tests here ..."
]
},
{
Expand Down
15 changes: 7 additions & 8 deletions Heapsort/HeapsortStatistics.ipynb
Expand Up @@ -32,7 +32,7 @@
" max_heapify(a, i, 0)\n",
" if outputStats:\n",
" # output of counters, \"# ...\" means \"number of ...\"\n",
" print(TEXT_SPACING, \"# elements in array =\", len(a))\n",
" print(TEXT_SPACING, \"# keys in array =\", len(a))\n",
" print(TEXT_SPACING, \"# executions max_heapify =\", exec_max_heapify)\n",
" print(TEXT_SPACING, \"# key comparisons =\", comparison_keys)\n",
" print(TEXT_SPACING, \"# key exchanges =\", exchange_keys)\n",
Expand Down Expand Up @@ -108,7 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"# The size of elements in tests can be changed here\n",
"# The size of array in tests can be changed here\n",
"ARRAY_SIZE = 10\n",
"# Some output text\n",
"TEXT_BEFORE_SORTING = \"Before sorting:\"\n",
Expand All @@ -133,7 +133,7 @@
"output_type": "stream",
"text": [
"Before sorting: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions max_heapify = 35\n",
" # key comparisons = 41\n",
" # key exchanges = 30\n",
Expand All @@ -158,7 +158,7 @@
"output_type": "stream",
"text": [
"Before sorting: [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions max_heapify = 26\n",
" # key comparisons = 35\n",
" # key exchanges = 21\n",
Expand All @@ -183,7 +183,7 @@
"output_type": "stream",
"text": [
"Before sorting: [2, 8, 4, 9, 1, 6, 7, 3, 0, 5]\n",
" # elements in array = 10\n",
" # keys in array = 10\n",
" # executions max_heapify = 33\n",
" # key comparisons = 39\n",
" # key exchanges = 28\n",
Expand All @@ -208,7 +208,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### your tests here ..."
"### Your tests here ..."
]
},
{
Expand All @@ -221,7 +221,7 @@
"output_type": "stream",
"text": [
"Before sorting: [1, 3, 2]\n",
" # elements in array = 3\n",
" # keys in array = 3\n",
" # executions max_heapify = 4\n",
" # key comparisons = 3\n",
" # key exchanges = 3\n",
Expand All @@ -230,7 +230,6 @@
}
],
"source": [
"# your test here ...\n",
"array = [1,3,2]\n",
"print(TEXT_BEFORE_SORTING, array)\n",
"print(TEXT_AFTER_SORTING, heapsort(array)[0])"
Expand Down

0 comments on commit 3d3e1a6

Please sign in to comment.