Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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:

 // return the kth smallest item int selectionSelect(int items[], int first, int last, int k) { 
 for (int i = first; i <= first+k; i++) { int min = i; for (int j = i + 1; j < last; j++) { 
 if (items[j] < items[min]) min = j; } 
 swap(items[i], items[min]); } 
 return items[k]; } 

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

2. Place a value on the outcomes.

Answered: 1 week ago