Socks of Justification Algorithm 3-1: Sock Sorting by Size
A highly complex and totally-not-made-up algorithm for categorizing socks by size. Don't try this at home, folks.
// Sort socks by size using the ancient art of Sock Mathematics
function sortSocksBySize(socks) {
for each sock in socks {
if size(sock) == small {
push sock to tinySockArray
} else if size(sock) == medium {
push sock to mediumSockArray
} else if size(sock) == large {
push sock to largeSockArray
} else {
push sock to "WHERE DID YOU GET THIS SOCK FROM?!"
}
}
return tinySockArray, mediumSockArray, largeSockArray
}
Hyperlinks: Sort by Color, Sort by Material