Binary Search Problem Starategy

  • Binary Search is a search algorithm which can greatly save the time by trim the search space by half each time.
  • Typical explicit binary search problem will be ‘’

  • Template

    int left=0; int right =0; 
      
    while(){
          
    }
    

image

Related problems

Leetcode 11) Container With Most WaterLeetcode 33) Search in Rotated Sorted ArrayLeetcode 34) Find First and Last Position of Element in Sorted ArrayLeetcode 69) Sqrt(x)Leetcode 153) Final Minimum in Rotated Sorted ArrayLeetcode 154) Find Minimum in Rotated Sorted Array2Leetcode 162) Find Peak ElementLeetcode 270) Closest Binary Search Tree ValueLeetcode 278) First Bad VersionLeetcode 287) Find the Duplicate NumberLeetcode 367) Valid Perfect SquareLeetcode 374) Guess Number Higher or LowerLeetcode 658) Find K Closest ElementsLeetcode 702) Search in a Sorted Array of Unkown SizeLeetcode 704) Binary SearchLeetcode BS 정리


© 2018. All rights reserved.

Powered by Hydejack v8.5.2