Блог пользователя KunalSin9h

Автор KunalSin9h, история, 9 часов назад, По-английски

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

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится

»
8 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hello! Could you advise some problems practice binary search?

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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