From 72c2862846a961b14feac5a19bad466edaa4d695 Mon Sep 17 00:00:00 2001 From: Jee Gikera Date: Sat, 21 Nov 2020 00:37:27 +0300 Subject: [PATCH] [chore] update readme --- README.md | 1 + recursion/tower_of_hanoi.ipynb | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/README.md b/README.md index 7a166b8..1c1720f 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ A catalogue of data structures implementation + algorithms and coding problems a - [Recursive binary search](recursion/recursive_binary_search.ipynb) - [Simulate rocket countdown](recursion/simulate_rocket_countdown.ipynb) - [Find min and max in array](recursion/min_max.ipynb) +- [Tower of Hanoi](recursion/tower_of_hanoi.ipynb) ## Searching diff --git a/recursion/tower_of_hanoi.ipynb b/recursion/tower_of_hanoi.ipynb index daafd5f..274fe60 100644 --- a/recursion/tower_of_hanoi.ipynb +++ b/recursion/tower_of_hanoi.ipynb @@ -65,6 +65,53 @@ "tower_of_hanoi(3, 1, 2, 3)" ] }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Moving 1 to 3\n", + "Moving 1 to 2\n", + "Moving 3 to 2\n", + "Moving 1 to 3\n", + "Moving 2 to 1\n", + "Moving 2 to 3\n", + "Moving 1 to 3\n", + "Moving 1 to 2\n", + "Moving 3 to 2\n", + "Moving 3 to 1\n", + "Moving 2 to 1\n", + "Moving 3 to 2\n", + "Moving 1 to 3\n", + "Moving 1 to 2\n", + "Moving 3 to 2\n", + "Moving 1 to 3\n", + "Moving 2 to 1\n", + "Moving 2 to 3\n", + "Moving 1 to 3\n", + "Moving 2 to 1\n", + "Moving 3 to 2\n", + "Moving 3 to 1\n", + "Moving 2 to 1\n", + "Moving 2 to 3\n", + "Moving 1 to 3\n", + "Moving 1 to 2\n", + "Moving 3 to 2\n", + "Moving 1 to 3\n", + "Moving 2 to 1\n", + "Moving 2 to 3\n", + "Moving 1 to 3\n" + ] + } + ], + "source": [ + "tower_of_hanoi(5, a=1, b=2, c=3)" + ] + }, { "cell_type": "code", "execution_count": null,