#Help regarding Binary Search

1 messages · Page 1 of 1 (latest)

forest spear
#

Hi, I was wondering why it took 3 comparisons against the middle to find 42 instead of 2 comparisons. Also can someone explain to me what happens in Binary search when there is an even number of elements? Where exactly is the midpoint then?

daring wigeonBOT
#

<@&987246399047479336> please have a look, thanks.

daring wigeonBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

array is not sorted?

polar kraken
#

always pick left. always pick right. doesn't matter

#

u have to refer to the exact code or definition of the algorithm in ur reference material

#

some break ties left, some right