diff --git a/Aufgabe02Testing.ipynb b/Aufgabe02Testing.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..984101ac2b607365b7026027fcaba28d2902009a --- /dev/null +++ b/Aufgabe02Testing.ipynb @@ -0,0 +1,95 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from Aufgabe02 import HeapSort, InsertionSort, CountingSort\n", + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "[43, 71, 75, 35, 77, 81, 98, 92, 41, 13, 87, 15, 83, 23, 97, 90, 64, 55, 27, 80] Unsortiert\n", + "[13, 15, 23, 27, 35, 41, 43, 55, 64, 71, 75, 77, 80, 81, 83, 87, 90, 92, 97, 98] Python sortiert\n", + "[13, 15, 23, 27, 35, 41, 43, 55, 64, 71, 75, 77, 80, 81, 83, 87, 90, 92, 97, 98] HeapSort\n", + "[13, 15, 23, 27, 35, 41, 43, 55, 64, 71, 75, 77, 80, 81, 83, 87, 90, 92, 97, 98] InsertionSort\n", + "[13, 15, 23, 27, 35, 41, 43, 55, 64, 71, 75, 77, 80, 81, 83, 87, 90, 92, 97, 98] CountingSort\n", + "\n", + "[68, 19, 33, 99, 26, 16, 23, 78, 34, 64, 50, 32, 87, 58, 23, 96, 10, 41, 83, 32] Unsortiert\n", + "[10, 16, 19, 23, 23, 26, 32, 32, 33, 34, 41, 50, 58, 64, 68, 78, 83, 87, 96, 99] Python sortiert\n", + "[16, 10, 19, 23, 23, 26, 32, 32, 33, 34, 41, 50, 58, 64, 68, 78, 83, 87, 96, 99] HeapSort\n", + "[10, 16, 19, 23, 23, 26, 32, 32, 33, 34, 41, 50, 58, 64, 68, 78, 83, 87, 96, 99] InsertionSort\n", + "[10, 16, 19, 23, 23, 26, 32, 32, 33, 34, 41, 50, 58, 64, 68, 78, 83, 87, 96, 99] CountingSort\n", + "\n", + "[24, 12, 16, 85, 66, 65, 65, 96, 21, 33, 80, 72, 60, 17, 58, 33, 35, 72, 67, 54] Unsortiert\n", + "[12, 16, 17, 21, 24, 33, 33, 35, 54, 58, 60, 65, 65, 66, 67, 72, 72, 80, 85, 96] Python sortiert\n", + "[12, 16, 17, 21, 24, 33, 33, 35, 54, 58, 60, 65, 65, 66, 67, 72, 72, 80, 85, 96] HeapSort\n", + "[12, 16, 17, 21, 24, 33, 33, 35, 54, 58, 60, 65, 65, 66, 67, 72, 72, 80, 85, 96] InsertionSort\n", + "[12, 16, 17, 21, 24, 33, 33, 35, 54, 58, 60, 65, 65, 66, 67, 72, 72, 80, 85, 96] CountingSort\n", + "\n", + "[63, 55, 70, 96, 56, 15, 85, 72, 32, 60, 59, 62, 43, 56, 77, 83, 24, 13, 99, 45] Unsortiert\n", + "[13, 15, 24, 32, 43, 45, 55, 56, 56, 59, 60, 62, 63, 70, 72, 77, 83, 85, 96, 99] Python sortiert\n", + "[13, 15, 24, 32, 43, 45, 55, 56, 56, 59, 60, 62, 63, 70, 72, 77, 83, 85, 96, 99] HeapSort\n", + "[13, 15, 24, 32, 43, 45, 55, 56, 56, 59, 60, 62, 63, 70, 72, 77, 83, 85, 96, 99] InsertionSort\n", + "[13, 15, 24, 32, 43, 45, 55, 56, 56, 59, 60, 62, 63, 70, 72, 77, 83, 85, 96, 99] CountingSort\n", + "\n", + "[51, 57, 88, 75, 87, 52, 35, 56, 42, 33, 37, 87, 18, 74, 74, 47, 91, 39, 12, 82] Unsortiert\n", + "[12, 18, 33, 35, 37, 39, 42, 47, 51, 52, 56, 57, 74, 74, 75, 82, 87, 87, 88, 91] Python sortiert\n", + "[12, 18, 33, 35, 37, 39, 42, 47, 51, 52, 56, 57, 74, 74, 75, 82, 87, 87, 88, 91] HeapSort\n", + "[12, 18, 33, 35, 37, 39, 42, 47, 51, 52, 56, 57, 74, 74, 75, 82, 87, 87, 88, 91] InsertionSort\n", + "[12, 18, 33, 35, 37, 39, 42, 47, 51, 52, 56, 57, 74, 74, 75, 82, 87, 87, 88, 91] CountingSort\n" + ] + } + ], + "source": [ + "num_list = range(10, 100)\n", + "for i in range(5):\n", + " array = random.choices(num_list, k=20)\n", + " print(\"\")\n", + " print(array, \"Unsortiert\")\n", + " print(sorted(array), \"Python sortiert\")\n", + " print(HeapSort(array), \"HeapSort\")\n", + " print(InsertionSort(array), \"InsertionSort\")\n", + " print(CountingSort(array), \"CountingSort\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.9.6 64-bit", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + }, + "orig_nbformat": 4, + "vscode": { + "interpreter": { + "hash": "11938c6bc6919ae2720b4d5011047913343b08a43b18698fd82dedb0d4417594" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}