Question: Q5 (20 points) On your scratch paper, draw the portion of the decision tree for Insertion sort on 5 elements 21, 22, 23, 24, as

 Q5 (20 points) On your scratch paper, draw the portion of

Q5 (20 points) On your scratch paper, draw the portion of the decision tree for Insertion sort on 5 elements 21, 22, 23, 24, as that contains the path from the root node to the permutation . Then answer the following questions on the answer sheet. Here the 1st node on the root to leaf () path is the root node, which contains the comparison a, > az? (a) What is comparison at the 1st node on the root to leaf path? (b) What is comparison at the 3rd node on the root to leaf path? (C) What is comparison at the 5th node on the root to leaf path? (d) What is comparison at the 7th node on the root to leaf path? (e) What is comparison at the 9th node on the root to leaf path? Q6 (16 pts) This question tests your understanding of activation records as taught in class. (a) Assume that we want to apply Quicksort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record for Quicksort onto the runtime stack before the completion of the algorithm? (b) Assume that we want to apply Quicksort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record for Partition onto the runtime stack before the completion of the algorithm? (c) Assume that we want to apply Mergesort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record Mergesort onto the runtime stack before the completion of the algorithm? (d) Assume that we want to apply Mergesort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record Merge onto the runtime stack before the completion of the algorithm? Q5 (20 points) On your scratch paper, draw the portion of the decision tree for Insertion sort on 5 elements 21, 22, 23, 24, as that contains the path from the root node to the permutation . Then answer the following questions on the answer sheet. Here the 1st node on the root to leaf () path is the root node, which contains the comparison a, > az? (a) What is comparison at the 1st node on the root to leaf path? (b) What is comparison at the 3rd node on the root to leaf path? (C) What is comparison at the 5th node on the root to leaf path? (d) What is comparison at the 7th node on the root to leaf path? (e) What is comparison at the 9th node on the root to leaf path? Q6 (16 pts) This question tests your understanding of activation records as taught in class. (a) Assume that we want to apply Quicksort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record for Quicksort onto the runtime stack before the completion of the algorithm? (b) Assume that we want to apply Quicksort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record for Partition onto the runtime stack before the completion of the algorithm? (c) Assume that we want to apply Mergesort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record Mergesort onto the runtime stack before the completion of the algorithm? (d) Assume that we want to apply Mergesort to sort the array A with 5 elements where the initial values of the array elements (from A[1] to A[5]) are A: 11 15 14 13 12 How many times do we push an activation record Merge onto the runtime stack before the completion of the algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!