Binary Search

A method in Time complexity of $O(nlogn)$

Introduction

  • Due to the time complexity of binary search is $O(nlogn)$ , which greatly improves the efficiency of algorithm, it appears in the problems frequently.
  • The data always keeps some sequence, like the number order.

Situation

The data sequence always have a special order, like number: 1, 2, 3…(So we can choose either left or right part to find the target)

Time complexity

$O(nlogn)$