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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started