Home / Expert Answers / Computer Science / you-are-given-an-infinite-array-a-in-which-the-first-n-cells-contain-integers-in-ascending-pa129

(Solved): You are given an infinite array A[] in which the first n cells contain integers in ascending ...



You are given an infinite array \( \mathrm{A}[\cdot] \) in which the first \( \mathrm{n} \) cells contain integers in ascendi

You are given an infinite array in which the first cells contain integers in ascending order and the rest of the cells are filled with infinity. You are not given the value of . Describe a divide conquer algorithm that takes an integer as input and finds a position in the array containing , if such a position exists, in time. (If you are disturbed by the fact that the array has infinite length, assume instead that it is of length , but that you don't know this length, and that the implementation of the array data type in your programming language returns the error message "infinity" whenever elements with are accessed.) A complete solution will (a) describe your algorithm in English (no pseudocode), (b) provide a justification of correctness (why does this approach work?), and (c) state and analyze its runtime in Big O notation, including a recurrence relation for it, if relevant.


We have an Answer from Expert

View Expert Answer

Expert Answer


APPROACH:We will use a vector of integers for storing the elements of array because we do not know the size of the array. ( Vector is basically a dyna
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe