•  
      tasks #45241 Binary Search (Recursive and Iterative)
    #45241
    Ritish Singh (ritish31)
    2022-08-16 10:30
    2022-08-16 10:30
    Details
    Binary Search (Recursive and Iterative)
    In a nutshell, this search algorithm takes advantage of a collection of elements that is already sorted by ignoring half of the elements after just one comparison.
    1. Compare x with the middle element.
    2. If x matches with the middle element, we return the mid index.
    3. Else if x is greater than the mid element, then x can only lie in the right (greater) half subarray after the mid element. Then we apply the algorithm again for the right half.
    4. Else if x is smaller, the target x must lie in the left (lower) half. So we apply the algorithm for the left half.
    5 - Medium
    State of Progress
    2022-05-22
    100
    2022-05-24
    Ritish Singh (ritish31)
    Rakesh Kumar Verma (rakesh.verma)
    2022-05-22
    Closed
    Attachments
    References
    References list is empty