If we have an arbitrary vector (V) like the one shown. Using Mathcad we want to order data from lowest to highest like the one shown on right. How would we do that?
Thanks for answering, however the main idea is to move down through the array comparing adjacent pairs and swapping the values if they are out of order. can you do it this way?
Thanks for answering, however the main idea is to move down through the array comparing adjacent pairs and swapping the values if they are out of order. can you do it this way?
Would you like to know how does the built-in function sort work?
In case you have difficulties finding a decent sorting algorithm to implement (which is very unlikely, I guess), I'd recommend this site: http://www.sorting-algorithms.com/
You can compare different algorithms, watch animations and look at the algorithm's pseudo code.
Find attached an attempt to create that kind of animiation in Mathcad for the bubble sort algorithm.
You may play around with the attached sheet, but the sort routine is protected for obvious reasons.