Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Explain the median-finding algorithms based on quickselect and counting select i

ID: 3906536 • Letter: E

Question

Explain the median-finding algorithms based on quickselect and counting select in a way that would be understandable to an intelligent lay person. You should not use any code (or even pseudo code) in your explanation, but you may need to use general concepts such as "compare", "swap", and "copy", and you'll certainly need to use procedural words such as "if" and "repeat".

You might find it helpful to consider an algorithm as if it were a game for which you need to define the rules. For example, an easy-to-understand select algorithm (but not a very efficient one) is based on a truncated version of selection sort, where the sort is stopped when the kth smallest item is moved into position:

If your task was to describe how you could use this approach to find the median, you could describe the process as if it was a solitaire game played with a deck of cards that contain the values to process.

Explanation / Answer

If you have any doubts, please give me comment...

Median will find after sorting of the list.

The medain will be depeneds upon the length.

if lenth is odd, the median of element is arr[len/2]

if length is even, the median of elements will be two arr[len/2], arr[(len/2)+1]

1 4 5 6 8 --> median is 5

1 4 6 7 8 9 -> median is 6, 7

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote