Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python code: Part B. Develop code to implement the Fake Sort routine described below. Given a list of numerical data, create a new list

Using Python code:

image text in transcribed

image text in transcribed

Part B. Develop code to implement the Fake Sort" routine described below. Given a list of numerical data, create a new list with the data from the original list sorted from minimum to maximum We'll call this "Fake Sort" because it's cheating (a bit) to create a new list while destroying the original list o Here's the basic algorithm . Find the minimum value in original list Append value to the new list Delete that element from original list Repeat until run out of members in the original list o Now, write a routine to reverse the sorted list This is simply reversing indices - no need for comparing values o Test your new routines on the grade data from above. o Use your Fake Sort to find the median of the grade data. Program 3: (Median, Sorting and Reversing Lists) The median of a data set is the "middle value of the data set. However, the method for determining the median depends on whether there are an odd number of data points or an even number of data points. For an odd number of data points, sort the data by value and chose the middle value. For the example shown below, the median value is 5. Given [34 9 5 775 2855319 2] Order [1 2 2 334 5 5 5 5 7 7 8 9 9] [1 2 3 5 6 7 8 9 10 11 12 13 14 15] For an even number of data points, sort the data by value and average the two "middle values. For the example shown below, the median is 4.5. Given Order [34 94 775 285 319 2] [1 2 2 3 3 4 4 5 5 7 7 8 9 9] (1 2 3 4 5 6 7 8 9 10 11 12 13 14 ] Please put the code for the following Program 3 exercises in the same file (Lab6b_Prog3.py). Please separate code for each part with appropriate comments

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

Students also viewed these Databases questions