Skip to content

Commit 7542c7e

Browse files
authored
Update binary_search.md
1 parent b5f8ab9 commit 7542c7e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

strings_arrays/binary_search.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
Binary Search Guide
2-
========================
3-
Binary search is a method for locating an element in a sorted list efficiently. Searching for an element can done naively in $O(N)$ time, but binary search speeds it up to $O(\log N)$. Binary search is a great tool to keep in mind for array problems.
1+
Binary search is a method for locating an element in a sorted list efficiently. Searching for an element can done naively in **O(N)** time, but binary search speeds it up to **O(log N)**. Binary search is a great tool to keep in mind for array problems.
42

53
Algorithm
64
------------------
@@ -60,4 +58,4 @@ def binary_search(nums, key):
6058

6159
## Runtime and Space Complexity
6260

63-
Binary search completes in $O(\log N)$ time because each iteration decreases the size of the list by a factor of 2. Its space complexity is constant because we only need to maintain two pointers to locations in the list. Even the recursive solution has constant space with tail call optimization.
61+
Binary search completes in **O(log N)** time because each iteration decreases the size of the list by a factor of 2. Its space complexity is constant because we only need to maintain two pointers to locations in the list. Even the recursive solution has constant space with tail call optimization.

0 commit comments

Comments
 (0)