Ruby, 99 chars (Gnome sort)
a=gets.scan /\w+/
p=1
while a[p]
a[p]>a[p-1]?p+=2:(a[p],a[p-1]=a[p-1],a[p])
p-=1if p>1
end
$><<a*?,
This just barely beats my bubble sort implementation:
Ruby, 110 104 101 chars (Bubble sortBubble sort)
s=gets.scan /\w+/
(z=s.size).times{(0..(z-2)).map{|i|s[i],s[i+1]=s[i+1],s[i]if s[i]>s[i+1]}}
$><<s*?,
It's a simple bubble sort implementation. ItThis does list.length
iterations, because worst-case scenario takes list.length - 1
iterations and one more really doesn't matter, and saves 2 chars.
Sample run:
c:\a\ruby>bubblesort.rb
hello,this,is,a,test,for,my,sorting,thingy,for,codegolf,stackexchange,it,uses,bubble,sort,and,it,is,sorty,and,yay,filler,items,blah,blah,blah,potato
a,and,and,blah,blah,blah,bubble,codegolf,filler,for,for,hello,is,is,it,it,items,my,potato,sort,sorting,sorty,stackexchange,test,thingy,this,uses,yay
Just for fun, a Quicksort version:
Ruby, 113 chars (QuicksortQuicksort)
q=->a{if a[1]
p=a.shift
l=[]
g=[]
a.map{|x|(x>p ?g:l).push x}
q[l]+[p]+q[g]
else
a
end}
$><<q[gets.scan /\w+/]*?,