Saturday, May 11, 2013

i am going to impliment all the sorts that are listed on wikipedia, i reserve the right to not worry about the case that the input is empty. although it's so easy to add, maybe i will.

i just implimented bubble sort, although i suspect it is not the sexy "think in ruby" way it should be. it was of course easy, messing with the output was the hardest part. but my goal is not to learn algorithms but rather to practice at ruby, and you have to work to a particular goal, otherwise you will only stick with what you know.
then i implimented cocktail sort, but  i couldn't get it to work without cheating, i think i am confused about how it's supposed to work, i need to work it out on paper but i didn't bring any. bleh.


next is odd-even sort, i'm not familiar with this one, we didn't do it in school.
-well that was pretty easy, i just had to create a range and use .step() to go through the indexes

next is comb sort, then gnome, the quicksort, then stooge sort. im  not doing bogosort.

comb is done, easy.

gnome is done: record time, if am getting a little bit practiced at this, also gnome sort is kinda sexy.

that was lies, quicksort is being annoying, i know how it works, but i've got my indexs  screwed up and i'm tired.


No comments:

Post a Comment