From 0963a43bccfe82d4bb8427eab6cfa3a3444c7020 Mon Sep 17 00:00:00 2001
From: marina <138340846+bt3gl-cryptography@users.noreply.github.com>
Date: Mon, 31 Jul 2023 16:18:44 -0700
Subject: [PATCH] Update README.md
---
searching/README.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/searching/README.md b/searching/README.md
index daeda5c..c295a5e 100644
--- a/searching/README.md
+++ b/searching/README.md
@@ -1,2 +1,19 @@
## searching
+
+
+
+### binary search
+
+
+
+* a binary search operates on a contiguous sequence with a specified left and right index. this is called the search space.
+* binary searching is composed of 3 sections:
+ * pre-processing: sort if collection is unsorted
+ * binary search: using a loop or recursion to divide search sapce in half after each comparison
+ * post-processing: determine viable candidates in the remaining space
+
+* there are 3 "templates" when writing a binary search:
+ * `while left < right`, with `left = mid + 1` and `right = mid - 1`
+ * `while left < right`, with `left = mid + 1` and `right = mid`, and `left` is returned
+ * `while left + 1 < right`, with `left = 1` and `right = mid`, and `left` and `right` are returned