From 488a8596b5a6f4a6535d0d9ad3f49592c121bed7 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Mon, 22 Apr 2024 00:33:21 +0400 Subject: [PATCH] 4 comment --- The Last Algorithms Course You'll Need/4. Binary Search.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/The Last Algorithms Course You'll Need/4. Binary Search.c b/The Last Algorithms Course You'll Need/4. Binary Search.c index b15f400..76ebc11 100644 --- a/The Last Algorithms Course You'll Need/4. Binary Search.c +++ b/The Last Algorithms Course You'll Need/4. Binary Search.c @@ -2,6 +2,10 @@ #define SIZE 4096 +// The complexity is O(log n) +// because we always half the amount +// like N/2 -> N/4 -> N/8 ... N/(2^k) which equals log n + int binary_search(int array[], int size, int offset, int value) { int pivot = size / 2;