From 55c40e91a5bcf02237a6aa17a51a854a770939c7 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Sun, 5 Jul 2015 16:49:37 -0400 Subject: [PATCH] Tweaked find loop start challenge test cases and algorith discussion. --- .../find_loop_start/find_loop_start_challenge.ipynb | 5 ++--- .../find_loop_start/find_loop_start_solution.ipynb | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/linked_lists/find_loop_start/find_loop_start_challenge.ipynb b/linked_lists/find_loop_start/find_loop_start_challenge.ipynb index cbbd406..58f8380 100644 --- a/linked_lists/find_loop_start/find_loop_start_challenge.ipynb +++ b/linked_lists/find_loop_start/find_loop_start_challenge.ipynb @@ -53,9 +53,8 @@ "* Empty list -> None\n", "* Not a circular linked list -> None\n", " * One element\n", - " * Two elements\n", - " * Three or more elements\n", - "* General case" + " * Two or more elements\n", + "* Circular linked list general case" ] }, { diff --git a/linked_lists/find_loop_start/find_loop_start_solution.ipynb b/linked_lists/find_loop_start/find_loop_start_solution.ipynb index c20814a..6a2287e 100644 --- a/linked_lists/find_loop_start/find_loop_start_solution.ipynb +++ b/linked_lists/find_loop_start/find_loop_start_solution.ipynb @@ -52,9 +52,8 @@ "* Empty list -> None\n", "* Not a circular linked list -> None\n", " * One element\n", - " * Two elements\n", - " * Three or more elements\n", - "* General case" + " * Two or more elements\n", + "* Circular linked list general case" ] }, { @@ -66,14 +65,14 @@ "* Use two pointers i, j, initialized to the head\n", "* Increment i and j until they meet\n", " * j is incremented twice as fast as i\n", - " * If j's next is NULL, we do not have a circular list\n", + " * If j's next is None, we do not have a circular list\n", "* When i and j meet, move j to the head\n", "* Increment i and j one node at a time until they meet\n", "* Where they meet is the start of the loop\n", "\n", "Complexity:\n", "* Time: O(n)\n", - "* Space: In-place" + "* Space: O(1)" ] }, {