Question: JAVA Consider a function that takes as argument an array list representing consecutive numbers from 1 to n (e.g., 1, 2, 3, 4, ...). Explain
JAVA
Consider a function that takes as argument an array list representing consecutive numbers from 1 to n (e.g., 1, 2, 3, 4, ...). Explain which algorithm you may create such that the function runs in (log log n). Your algorithm does not need to do something useful, but it has to do it in (log log n).
Hint: (log log n) arises when one function over the data results in data of size log n, which is further processed through another function in log n.
2) Consider a function that takes as arguments two arrays of the same length, which represent consecutive numbers from 1 to n. Explain which algorithm you may create such that the function runs in (log2 n). Your algorithm does not need to do something useful, but it has to do it in (log2 n).
Hint: (log2 n) is the product of two log functions, that is, log n * log n.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
