A hash table of length 10 uses open addressing with hash fun…
A hash table of length 10 uses open addressing with hash function h(k) = k % 10, and quadratic probing. After inserting 4 values into an empty hash table, the table is as shown below. 0 1 2 42 3 23 4 5 55 6 66 7 8 9 At what index value 12 will be inserted?
Read DetailsA hash table of length 10 uses open addressing with hash fun…
A hash table of length 10 uses open addressing with hash function h(k) = k % 10, and separate chaining. After inserting several values into an empty hash table, the table is as shown below. 0 1 2 42 3 23 4 5 55 6 46 7 8 9 At what index will the value 12 be inserted?
Read DetailsConsider the following array: 3, 56, 24, 5, 39, 4, 27, 1 Con…
Consider the following array: 3, 56, 24, 5, 39, 4, 27, 1 Consider the algorithm described in class that turns the above array into a min heap. Answer the following two questions: [1] How many times do two numbers swap locations in the array? [2] What number is stored in slot/index 4 after the array is turned into a min heap?
Read DetailsConsider the following function: public static void func1(d…
Consider the following function: public static void func1(double[] real, double[] imag) { int n = real.length; if (n > 1){ double[] evenReal = new double[n / 2]; double[] evenImag = new double[n / 2]; double[] oddReal = new double[n / 2]; double[] oddImag = new double[n / 2]; for(int i = 0; i < n / 2; i++){ evenReal[ i ] = real[2 * i]; evenImag[ i ] = imag[2 * i]; oddReal[ i ] = real[2 * i + 1]; oddImag[ i ] = imag[2 * i + 1]; } func1(evenReal, evenImag); func1(oddReal, oddImag); for(int k = 0; k < n / 2; k++){ double tReal = Math.cos(-2 * Math.PI * k / n) * oddReal[ k ] - Math.sin(-2 * Math.PI * k / n) * oddImag[ k ]; double tImag = Math.sin(-2 * Math.PI * k / n) * oddReal[ k ] + Math.cos(-2 * Math.PI * k / n) * oddImag[ k ]; real[ k ] = evenReal[ k ] + tReal; imag[ k ] = evenImag[ k ] + tImag; real[k + n / 2] = evenReal[ k ] - tReal; imag[k + n / 2] = evenImag[ k ] - tImag; } } } Provide the recurrence relation for the code in terms of R(n) = [A] * R([B]) + O([C]). When finished, provide the overall [Runtime] of the function. Do not put any spaces in your answers and do not capitalize anything. If your answer is n^2, put in n^2, not n ^ 2. Similarly, if your answer is n*log(n), put in exactly n*log(n), do not put in n * log (N).
Read Details