mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-15 17:30:52 +00:00
remove time measure
This commit is contained in:
parent
73dc3210e5
commit
671c19c4d8
@ -1,6 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
import time
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -31,7 +30,6 @@ SAMPLE_SIZE = 1000
|
|||||||
numbers = random.sample(range(LOWER, UPPER), SAMPLE_SIZE)
|
numbers = random.sample(range(LOWER, UPPER), SAMPLE_SIZE)
|
||||||
numbers.sort()
|
numbers.sort()
|
||||||
|
|
||||||
start = time.time()
|
|
||||||
result = None
|
result = None
|
||||||
while result is None:
|
while result is None:
|
||||||
guess = random.randrange(LOWER, UPPER)
|
guess = random.randrange(LOWER, UPPER)
|
||||||
@ -39,4 +37,4 @@ while result is None:
|
|||||||
result = binary_search(numbers, guess)
|
result = binary_search(numbers, guess)
|
||||||
|
|
||||||
|
|
||||||
print(f"Found {guess} at index {result}. Running time {time.time() - start}")
|
print(f"Found {guess} at index {result}.")
|
||||||
|
Loading…
Reference in New Issue
Block a user