[Basic Algorithm] Dichotomy

Two minutes note

  1. The essence of dichotomy: two-stage (see rotating array). Monotonicity must be dichotomy, and dichotomy is not necessarily monotonic!
  2. The dichotomy must meet the boundary conditions, such as the dichotomy condition >=x, but the final dichotomy may be >x, and no = x. See the integer dichotomy template question.
  3. Dichotomous template, see y

Template question

Integer dichotomy
Floating point dichotomy

Index dichotomy

Range dichotomy

69. Square root of x (note overflow, boundary)
367. Effective perfect square number (multiplying two numbers is easy to burst int)

Guess you like

Origin blog.csdn.net/weixin_43154149/article/details/113729964