In: Computer Science
Suppose you are given a list of n integers, each of size at most 100n. How many operations would it take you to do the following tasks (in answering these questions, we are interested primarily in whether it will take logn, sqrt(n), n, n^2, n^3, 2^n, ... steps. In other words, ignore multiplicative constants.)
1. Determine the longest sequence of consecutive integers belonging to the list.
2. Determine the number of primes in the list.
3. Determine whether there are three integers x, y and z from the list so that x + y = z.
4. Determine whether there are three integers x, y, and z from the list so that x^2 + y^2 = z^2.