A is an arraylist of size n the elements of a are integers


A is an ArrayList of size N. The elements of A are integers, they are in sorted order increasing from the low end of the array, and no two integers are the same. Variable x is an integer. Which of the following operations takes time that is less than O(N). That is, the operation is guaranteed to be completed in time that is O(1), O(log N), or big-oh of some function that grows more slowly than N.
1. Add an integer that is one greater than the largest element of A.
2. Find the second largest element of A.
3. Determine whether the integers in A are 1, 2,...,N exactly.
4. Determine whether the integer x is in A. Use binary search.
5. Determine whether the integer x is in A.
6. Determine whether there are any negative integers in A.
7. Insert into A the integer that is 1 less than the current smallest element.
8. Delete the integer 10x from A.
9. Insert the integer 2x into A.
10. Check whether two consecutive integers appear in A.
11. Find the sum of the elements of A.
12. Delete the middle element of A (assume N is odd).
13. Insert the integer x into A.
14. Delete the integer x from A.
15. Delete the smallest element of A.
16. Insert the integer 100 into A. Delete the smallest element of A.

Solution Preview :

Prepared by a verified Expert
PL-SQL Programming: A is an arraylist of size n the elements of a are integers
Reference No:- TGS0651169

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)