diff options
author | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-02-25 16:48:33 +0200 |
---|---|---|
committer | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-02-25 16:48:33 +0200 |
commit | 4385db889521de9e228dc02880b19546c7ad73b2 (patch) | |
tree | e8cd821cb7cda01a7114797ccdf69bddf0459c09 | |
parent | 52c676985e8a11b8f70ed3c6c00750c53a0e7eba (diff) | |
download | cs-y13-4385db889521de9e228dc02880b19546c7ad73b2.tar.gz cs-y13-4385db889521de9e228dc02880b19546c7ad73b2.tar.bz2 cs-y13-4385db889521de9e228dc02880b19546c7ad73b2.zip |
feat: resolve temporary merge conflicts
-rw-r--r-- | notebooks/dictionaries.ipynb | 23 | ||||
-rw-r--r-- | notebooks/linked_lists.ipynb | 4 | ||||
-rw-r--r-- | notebooks/sorting_algorithms.ipynb | 37 |
3 files changed, 52 insertions, 12 deletions
diff --git a/notebooks/dictionaries.ipynb b/notebooks/dictionaries.ipynb index dabcc4f..aa68193 100644 --- a/notebooks/dictionaries.ipynb +++ b/notebooks/dictionaries.ipynb @@ -2,9 +2,18 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "{'Kim Jong Un': 69, 'Kim Il-Sung': 150, 'Skibidi Rizzler': 66}\n" + ] + } + ], "source": [ "# Activity 19P\n", "\n", @@ -31,8 +40,16 @@ "name": "python3" }, "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", "name": "python", - "version": "3.12.8" + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.7" } }, "nbformat": 4, diff --git a/notebooks/linked_lists.ipynb b/notebooks/linked_lists.ipynb index 5f11e96..3b1ea36 100644 --- a/notebooks/linked_lists.ipynb +++ b/notebooks/linked_lists.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -90,7 +90,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.7" } }, "nbformat": 4, diff --git a/notebooks/sorting_algorithms.ipynb b/notebooks/sorting_algorithms.ipynb index 2e6326d..f1d8114 100644 --- a/notebooks/sorting_algorithms.ipynb +++ b/notebooks/sorting_algorithms.ipynb @@ -2,9 +2,32 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n", + "[31, 61, 29, 87, 82, 97, 9, 34, 67, 76]\n", + "['A', 'B', 'C', 'D', 'E']\n" + ] + }, + { + "ename": "TypeError", + "evalue": "'>' not supported between instances of 'str' and 'int'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[2], line 73\u001b[0m\n\u001b[1;32m 71\u001b[0m test_existsness(\u001b[38;5;241m100\u001b[39m)\n\u001b[1;32m 72\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;18m__name__\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__main__\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m---> 73\u001b[0m \u001b[43mmain\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "Cell \u001b[0;32mIn[2], line 61\u001b[0m, in \u001b[0;36mmain\u001b[0;34m()\u001b[0m\n\u001b[1;32m 59\u001b[0m query \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28minput\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mYour query for item: \u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 60\u001b[0m qstring \u001b[38;5;241m=\u001b[39m \u001b[38;5;28minput\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mString item: \u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m---> 61\u001b[0m \u001b[43mbinsearch\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnarr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mquery\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 62\u001b[0m found1 \u001b[38;5;241m=\u001b[39m linear_search(array, query)\n\u001b[1;32m 63\u001b[0m found2 \u001b[38;5;241m=\u001b[39m linear_search_while(array, query)\n", + "Cell \u001b[0;32mIn[2], line 18\u001b[0m, in \u001b[0;36mbinsearch\u001b[0;34m(arr, item)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFound here\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m found\n\u001b[0;32m---> 18\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43marr\u001b[49m\u001b[43m[\u001b[49m\u001b[43mindex\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m>\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m:\n\u001b[1;32m 19\u001b[0m ubound \u001b[38;5;241m=\u001b[39m index \u001b[38;5;241m-\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m arr[index] \u001b[38;5;241m<\u001b[39m item:\n", + "\u001b[0;31mTypeError\u001b[0m: '>' not supported between instances of 'str' and 'int'" + ] + } + ], "source": [ "import random\n", "def generate_test_data(length: int, _range: tuple):\n", @@ -83,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -92,8 +115,8 @@ "text": [ "['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n", "100 checks passed!\n", - "['qibuvxrvcf', 'nmbxubyowk', 'ntszdjhhwf', 'xhjsoifdno', 'kbdwllyfmo', 'ndmngppihm', 'footfyjpfd', 'ridhoqmalu', 'nxlubshvcj', 'fjnnntfxur']\n", - "['fjnnntfxur', 'footfyjpfd', 'kbdwllyfmo', 'ndmngppihm', 'nmbxubyowk', 'ntszdjhhwf', 'nxlubshvcj', 'qibuvxrvcf', 'ridhoqmalu', 'xhjsoifdno']\n" + "['mahoylwzsf', 'oqsmmuavgz', 'glrgtvhwur', 'tmlvraonck', 'jutgjynhmg', 'qrbozldpmj', 'wepatxjctj', 'axlymmpbns', 'dieazmvcin', 'ecfxsjbjha']\n", + "['axlymmpbns', 'dieazmvcin', 'ecfxsjbjha', 'glrgtvhwur', 'jutgjynhmg', 'mahoylwzsf', 'oqsmmuavgz', 'qrbozldpmj', 'tmlvraonck', 'wepatxjctj']\n" ] } ], @@ -141,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -193,7 +216,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.7" } }, "nbformat": 4, |