•  
      tasks #45390 Python Program for Binary Search (Recursive and Iterative)
    #45390
    Mohini Singh (mohini)
    2022-08-16 22:04
    2022-08-16 22:04
    Details
    Python Program for 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
    Mohini Singh (mohini)
    Rakesh Kumar Verma (rakesh.verma)
    2022-05-23
    Closed
    Attachments
    References
    References list is empty