summaryrefslogtreecommitdiff
path: root/notebooks/p41-mj17.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'notebooks/p41-mj17.ipynb')
-rw-r--r--notebooks/p41-mj17.ipynb67
1 files changed, 47 insertions, 20 deletions
diff --git a/notebooks/p41-mj17.ipynb b/notebooks/p41-mj17.ipynb
index 4322d61..d60ea40 100644
--- a/notebooks/p41-mj17.ipynb
+++ b/notebooks/p41-mj17.ipynb
@@ -10,20 +10,9 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [
- {
- "ename": "",
- "evalue": "",
- "output_type": "error",
- "traceback": [
- "\u001b[1;31mRunning cells with 'venv (Python 3.11.8)' requires the ipykernel package.\n",
- "\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
- "\u001b[1;31mCommand: '/home/stvnliu/Development/Learn/cs-y13/.devenv/state/venv/bin/python -m pip install ipykernel -U --force-reinstall'"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# Q4b\n",
"class Node:\n",
@@ -56,9 +45,32 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[None, None, None, None, None, None, None, None]\n",
+ "at: 0\n",
+ "at: 1\n",
+ "at: 2\n",
+ "at: 3\n",
+ "at: 4\n",
+ "at: 5\n",
+ "at: 6\n",
+ "[0] [None] -> (1)\n",
+ "[1] [None] -> (2)\n",
+ "[2] [None] -> (3)\n",
+ "[3] [None] -> (4)\n",
+ "[4] [None] -> (5)\n",
+ "[5] [None] -> (6)\n",
+ "[6] [None] -> (7)\n",
+ "[7] [None] -> (-1)\n"
+ ]
+ }
+ ],
"source": [
"# Q4 c) iii)\n",
"NULL_POINTER = -1\n",
@@ -87,9 +99,24 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[None, None, None, None, None, None, None, None]\n",
+ "at: 0\n",
+ "at: 1\n",
+ "at: 2\n",
+ "at: 3\n",
+ "at: 4\n",
+ "at: 5\n",
+ "at: 6\n"
+ ]
+ }
+ ],
"source": [
"# Q4 c) iv)\n",
"contacts = LinkedList()"
@@ -97,7 +124,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -112,7 +139,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "venv",
+ "display_name": ".venv",
"language": "python",
"name": "python3"
},
@@ -126,7 +153,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.8"
+ "version": "3.12.7"
}
},
"nbformat": 4,