You are given pseudocode of the merge sort algorithm: mergeSort(int[] numbers, int start, int end){ if (start < end) //base case is start = end and sorting an array of 1 { middle = (start+end)/2; mergeSort(numbers, start, middle); mergeSort(numbers, middle+1, end); merge(numbers, start, middle, end); }} Merge Algorithm Access the first item from both sequences: start to middle is sequence_1 and middle+1 to end is sequence_2.while not finished with either sequence Compare the current items from the two sequences, copy the smaller current item to the output sequence and access the next item from the input sequence whose item was copied.Copy any remaining items from the first sequence to the output sequence.Copy any remaining items from the second sequence to the output sequence.override the values in the output sequence to the original sequence provided as input. If we have an array of size n that is used as input to the mergeSort() function, What should be the values for the start and end parameters for the initial call to mergeSort()? Assume array is 0 indexed and state your answers in terms of size, n. start: [start] end: [end] What is the time complexity of a single merge() operation in the worst case in terms of Big O notation? State your answers in terms of size, n. e.g. [merge] The maximum number of stack frames for the mergeSort() at any given point of time in terms of Big O notation will be: [calls] State your answers in terms of size, n. e.g. If the call to merge function is merge([5, 2, 1, 6], 0, 0, 1), then the value of numbers vector at the end of this call will be [end_val]. State your answer in terms of four numbers separated by spaces, e.g. 1 2 6 7 If mergeSort is called with the following parameters: mergeSort([ 1 ], 0, 0), how many times will the merge() function be called recursively: [merge_call]
Blog
The mystery() function corresponds to which popular set oper…
The mystery() function corresponds to which popular set operation: #include #include #include std::string mystery(std::string x, std::string y) { std::set my_set; for(char i: x) my_set.insert(i); for(char i: y) { if(my_set.count(i) != 0) my_set.erase(i); } std::string ans = “”; for(auto i: my_set) ans += i; return ans;}int main(){ std::cout
Suppose a hash table has 10 buckets and 40 elements stored u…
Suppose a hash table has 10 buckets and 40 elements stored using separate chaining. What is the load factor (α)?
Consider the following undirected graph with 6 vertices (1–6…
Consider the following undirected graph with 6 vertices (1–6) and the edges listed in the order they are processed: {1, 2} {2, 3} {3, 4} {4, 5} {2, 5} {5, 6} Assuming a Disjoint Set structure with initial sets {{1}, {2}, {3}, {4}, {5}, {6}} is used for detecting cycles, answer the following 1. Which edge first creates a cycle? [x] 2. After processing the first four edges ({1,2},{2,3},{3,4},{4,5}), what is the set containing vertex 1? [y] 3. How many disjoint sets remain after a cycle is found using the disjoint set data structure? [z] 4. How many union operations actually merge two different sets before detecting a cycle? [w]
Below is an image of a coffee cup calorimeter with 89.4 g or…
Below is an image of a coffee cup calorimeter with 89.4 g or water. The temperature of water is measured before and after the addition of an 30.0 g of unknown metal. How much energy is gained or lost by the water. The specific heat of water is s = 4.184 .
The acid HA dissociates according to the image below. Determ…
The acid HA dissociates according to the image below. Determine what the acid could be based on how it dissociates.
How much iron (III) oxide (Fe2O3) will be produced with 12.6…
How much iron (III) oxide (Fe2O3) will be produced with 12.6 g of iron reacts with 4.19 g of oxygen?
At 25 oC a researcher measures the pH of a solution, an imag…
At 25 oC a researcher measures the pH of a solution, an image of the pH meter is shown below determine the correct statement regarding the solution.
A scientist measures out the following volume of stock hydro…
A scientist measures out the following volume of stock hydrochloric acid with a concentration of 10.5 M (the volume of the stock added is shown in the figure of the graduated cylinder below with the arrow pointing to the bottom of the meniscus). The solution is diluted to a final volume of 250.0 mL, what is the final concentration of the diluted solution.
What volume in mL of 0.322 M magnesium hydroxide (Mg(OH)2) i…
What volume in mL of 0.322 M magnesium hydroxide (Mg(OH)2) is required to reach the equivalence point (neutralize) 45.0 mL of 0.319 M hydroiodic acid (HI)?