Thursday, May 17, 2007

-=Selection Sort=-

This is a nice easy quadratic sorting algorithm similar to BubbleSort. Think of this one like arranging cards in your hand. You take the first card and note down its number (4) then you look along the cards and find one smaller (3), you note down where the smaller card is located and then you carry on trying to find smaller than that. Once you've found the smallest, you swap the first card with the smallest. Then you repeat starting from the second card. Easy!

view the php demostration here

and the source code here

-=bouj=-

No comments: