You are given a sorted array X of distinct integers {x1, x2, . . . , xn}, drawn from 1 to m, where m > n.

profileptn32

a) Give an O(log n) algorithm to find an integer from [1, m] that is not present in A and find the smallest such integer. 

b) Explain why the algorithm runs in O(log n) time. 

c) Explain why your algorithm is correct.

    • 9 years ago
    • 15
    Answer(2)

    Purchase the answer to view it

    blurred-text
    NOT RATED

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      GiveanO.docx