9
Sep

Sorting Algorithms – English


Computers often have to sort lists into order sometimes alphabetically by date or some other value usually computers can only compare two values at a time we’re going to simulate this by using balance scales to make the comparison each container is a different weight and you need to use the scales to compare them one approach to sorting them from lightest to heaviest is to find the heaviest one first this is done by comparing each container with the heaviest one so far after all the containers have been compared we have found the heaviest container we then do this again to select the heaviest from the remaining containers this builds up our sorted list one item at a time the list is finally sorted after 55 comparisons a faster way is to pick the container at random and split the collection into two groups those that are lighter on the left and the heavier ones on the right now all we need to do is sort the two groups we can do this by using the same method on each group pick a container at random and split its group into two parts the process continues in the same way any unsorted group is split into two groups until there’s only one container in a group a single container is already sorted this method might seem tricky but it only needed 27 comparisons that’s why it’s called quicksort for more information about the SEC tivity and the unplugged project visit our website at CES unplugged or you

Tags: , , , ,

8 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *