One of the most common and necessary actions in computing is to sort data. It allows us to make sense of or find information easier. It is for this reason that there are over 30 different types of sorting.
We can define sorting as the ordering of data according to some criteria. The most common ways of that we use are lexicographical and numerical, but that does not mean there aren't other, more complex ways of sorting. As humans we are capable of sorting a group of items very quickly because our brains are capable of viewing the entire list of items and doing multiple comparisons at the same time.
Computers are not so lucky: They can only make one comparison at a time and as such need some sort of strategy with which to sort. Such strategies typically involve a comparison of two elements in a list and a swap.
Create your own sorting strategy. In groups, brainstorm and come up with your own sorting strategy. Once you have a strategy, try it out with a random group of manipulatives (cards) to see if it will result in a sorted array. While executing your sort note the following:
Present your strategy, being sure to tell the class
A is an array
v is the item to swap
for j = 0 to size(A) - 1
v = j
for i = j + 1 to size(A)
if A[i] < A[v]
v = i
end if
end for
if v not = j
swap (A[j], A[v])
end if
end for
A is an array
v is the item to insert
for i = 1 to size(A)
v = A[i]
j = i
while j > 0 and v < A[j - 1]
A[j] = A[j - 1]
j-= 1
end while
A[j] = v
end for