Writing a Sorting Algorithm
Total points 4
This assignment is an opportunity for you to develop an
algorithm of your own and have someone else execute it to give you
feedback on its correctness and specificity.
You will write an
algorithm that sorts temperature data from least to greatest. To do
this, you will work through the first four of the Seven Steps.
Introduction to the data
NOAA's National Centers for Environmental Information collects global
climate data and aggregates this data to provide information on climate
trends and variability. One product they offer is a monthly regional
analysis. The following table gives "anomaly" data by continent for
January 2017. "Anomaly" means the value is the temperature difference
from the average temperature from years 1910–2000.
Your task is to develop an algorithm that would sort data such as these
from least to greatest. Specifically, given an unsorted set of N decimal
values, your algorithm should sort them to give an answer of the sorted
data. For this set of N = 6, your algorithm should produce:
Step 1: Work an example by hand
Take the list
of values, and sort them by hand. Sort them the way that comes most
naturally to you. Do not research sorting algorithms or try to figure
out the most efficient method—that is not the point of this assignment.
Step 2: Write down exactly what you did
carefully about how you performed the sort by hand. What values did you
compare? In what order? How did you know when you were done? Write down
these steps exactly.
Step 3: Generalize
Look for patterns in the steps you wrote down for Step 2. If you
repeated sets of steps, how could you count repetitions? If you swapped
certain values under certain conditions, what were they? Are there
variables you need to name in order to reuse? Write down your
step-by-step generalized algorithm.
Step 4: Test your algorithm
your algorithm for a different set of data, such as a subset of the
given data, data you make up, or another month's climate data, such as
February 2017: https:
Does your algorithm work for any N? Have you thought of corner cases it might need to handle, such as N = 0 or N = 1?
How to submit:
Enter your algorithm in the text box. You can work
in another program and copy/paste into the box, or you can type your
Your algorithm should be written in clear English, not C code.
What do you think?
Your answer cannot be more than 10000 characters.