KunalSin9h's blog

By KunalSin9h, history, 7 hours ago, In English

While implementing Binary Search, we may face few problems, they are:

• What is the value of lower bound?

• What is the value of upper bound?

• How do I calculate my mid value?

• What condition should I write in my while loop?

• When my predicate is true, should I assign my mid to lower or upper bound?

• Whats my final answer, value of lower or upper bound?

Inspired from @Benq solutions, I wrote down all you need to know about correctly implementing binary search and its sub-classes (First True and last True), which works every time.

Read full Paper: Here on Academia.edu

  • Vote: I like it
  • -25
  • Vote: I do not like it

»
7 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hello! Could you advise some problems practice binary search?

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I have found some good problems in the Binary Section of USACO Guide https://usaco.guide/silver/binary-search