Sorting list...

Monkey Forums/Monkey Programming/Sorting list...

degac(Posted 2011) [#1]
How can sort the content of list?
I can't find any Sort() command or equivalent.


therevills(Posted 2011) [#2]
Looks like we'll have to write one ourselves...

So whats your fav sort rountine? Bubble, quick? :P


skid(Posted 2011) [#3]
I think a Map will naturally keep it's keys sorted in a binary tree:

Function Main()
	Local map:=New StringMap<Object>()

	map.Set("C",Null)
	map.Set("B",Null)
	map.Set("A",Null)

	For Local a:=Eachin map.Keys
		Print a
	Next
End


bit overkill compared to an official SortedList...


Canardian(Posted 2011) [#4]
Doesn't like every native language have a built-in qsort() function? At least C/C++ does. Those might be faster and more optimized than a quicksort functio written in Monkey.