From 8e94aa6b7f2666ea2f386c0f686dccd6134e5a3d Mon Sep 17 00:00:00 2001 From: Pablo Osorio Lopez Date: Thu, 1 Oct 2020 19:58:24 -0500 Subject: [PATCH 1/2] Fix: Corrected test. List in test must be ordered. --- searches/simple_binary_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searches/simple_binary_search.py b/searches/simple_binary_search.py index 8495dda8d518..9a17ed202acc 100644 --- a/searches/simple_binary_search.py +++ b/searches/simple_binary_search.py @@ -31,7 +31,7 @@ def binary_search(a_list: list[int], item: int) -> bool: False >>> print(binary_search([], 1)) False - >>> print(binary_search([.1, .4 , -.1], .1)) + >>> print(binary_search([-.1, .1 , .8], .1)) True """ if len(a_list) == 0: From d7adf394609cc3b7d1eab2af312062b81afa62ed Mon Sep 17 00:00:00 2001 From: Pablo Osorio Lopez Date: Wed, 7 Oct 2020 09:17:41 -0500 Subject: [PATCH 2/2] Add tests with big lists. --- searches/simple_binary_search.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/searches/simple_binary_search.py b/searches/simple_binary_search.py index 9a17ed202acc..d1f7f7a51cbc 100644 --- a/searches/simple_binary_search.py +++ b/searches/simple_binary_search.py @@ -33,6 +33,12 @@ def binary_search(a_list: list[int], item: int) -> bool: False >>> print(binary_search([-.1, .1 , .8], .1)) True + >>> binary_search(range(-5000, 5000, 10), 80) + True + >>> binary_search(range(-5000, 5000, 10), 1255) + False + >>> binary_search(range(0, 10000, 5), 2) + False """ if len(a_list) == 0: return False