Reference no: EM133482114
Question:Shown below is the code for the bubble sort consisting of two recursive methods that replace the two nested loops that would be used in its iterative counterpart:
void bubbleSort(int array[]) { sort(array, 0);
} void sort(int[] array, int i) {
if (i < array.length - 1) { bubble(array, i, array.length - 1); sort(array, i + 1);
}
}
void bubble(int[] array, int i, int j) { if (j <= i)
return;
if (array[j] < array[j - 1]) { int temp = array[j];
array[j] = array[j - 1]; array[j - 1] = temp;
}
bubble(array, i, j - 1);
}
Question 1. Draw the recursion tree for bubbleSort when it is called for an array of length 4 with data that represents the worst case. Show the activations of bubbleSort, sort and bubble in the tree. Explain how the recursion tree would be different in the best case.
Question 2. Refer back to the recursion tree you provided in the previous problem. Determine a formula that counts the numbers of nodes in that tree. What is Big-O for execution time? Determine a formula that expresses the height of the tree. What is the Big-O for memory?
Describe how the estimated variability in selling prices
: Describe how the estimated variability in selling prices varies as the mean selling price varies from 100 thousand to 500 thousand dollars
|
Define business profiles, processes and modeling
: Define business profiles, processes, and modeling. Explain the difference between vertical and horizontal systems packages.
|
What are some examples of form validation we would want
: What are some examples of form validation we would want to do solely on the server? When might we do it only on the client?
|
Develop a strategy for backing up the company
: What do you need to consider while deciding the best specifications for processor, memory, and disk space
|
Draw the recursion tree for bubblesort
: List the capabilities that any data and information processor, whether organic, mechanical, electrical, or optical, must have
|
Discuss key concepts as they may relate to your chosen case
: Discuss key concepts as they may relate to your chosen case. Apply facts from your case to support conclusions on the applicability of concepts.
|
Calculate the accounts receivable turnover
: Calculate the accounts receivable turnover and the average collection period ratio for The Coca-Cola Company for the most current year presented.
|
Why is governance difficult in cyberspace
: Why is governance difficult in cyberspace? Share an example and explain your response
|
Explain how the functions in your program are designed
: Can you explain how the functions in your program are designed to improve modularity, code organization and reusability.
|