Task 3: Sorting an array based list Assume you’re given a list of numbers to sor
ID: 3749963 • Letter: T
Question
Task 3: Sorting an array based list
Assume you’re given a list of numbers to sort (in either order). Develop an algorithm to sort it.
Note: Swift also has a sort function that can be used to sort arrays. But then again, our objective in this activty is to study sorting algorithm as we work with arrays. So we will develop our own sort function(s).
To develop an algorithm you need to be able to solve the problem manually first using some sample data.
Create a sample list to work with
Sort the sample list manually
Note: As you develop your algorithm, you need to assume that the list is very long to the point that you can’t visually scan it all at once and sort the data mentally. This is to simulate the fact that the computer can only “see” one number at a time as it re-arranges them
Once you figure out how to sort manually, trace your steps and write them down into an algorithm
Verify your algorithm with another simple example
Implement your algorithm in Swift
Test it using one of the examples you used in the steps above
Be ready to demo your algorithm and your Swift.
Submit your final solution for credit
Explanation / Answer
////////////////////////////////////////////////////////////////////////////
The idea is very simple. see the below strategy
so finally the array is sorted now
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.