Question: Java 1. Write a Java function minimum . This function is passed a java.util.ArrayList parameter and returns the smallest value stored in the array list.
Java
1.
Write a Java function minimum. This function is passed a java.util.ArrayList
2.Suppose you have to implement a search algorithm in a high programming language such as Java or C++. You are given an array which is not sorted and its rather small, in the order of a few dozen elements. You expect that that your algorithm will be run a very large number of times. Which search method would you use: sequential, sorted, or binary? Why? Please consider in your analysis whether you would sort the array before running the search algorithm.
3.Consider the following array. Suppose that the array will be sorted using quicksort.
| location | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| array[location] | 24 | 17 | 23 | 12 | 9 | 7 | 19 | 15 | 21 | 3 |
If the initial pivot is 17, what will be the location of the pivot after the first iteration of the algorithm is completed? Why?
4. Suppose q is a queue of characters in the program below. q.insert('a'); q.insert('b'); q.insert('c'); q.insert('d'); System.out.println(q.getFront()); What is the value displayed by the System.out.println statement?
5.Order the following functions according to their growth rates from slowest to fastest.
| f(n) = n | g(n) = log n | h(n) = 2n |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
