Question: Call Tree Let's illustrate the call tree for finding the median: Initial Call: Array: Pivot: Partitioned: Pivot position: ( 0 - based index ) Recursive
Call Tree
Let's illustrate the call tree for finding the median:
Initial Call:
Array:
Pivot:
Partitioned:
Pivot position:
based index
Recursive Call on Left Subarray:
Array:
Pivot:
Partitioned:
Pivot position:
Recursive Call on Right Subarray:
Array:
Pivot:
Partitioned:
Pivot position:
Recursive Call on Left Subarray:
Array:
Pivot:
Partitioned:
Pivot position:
Recursive Call on Left Subarray:
Array:
Pivot:
Partitioned:
Pivot position:
The pivot
is now at the th position based index which is the th smallest element in the array. Therefore, the median is
Conclusion
The median of the array
is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
