HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sorting

02-25-2009, 02:53 AM#1
Joker
What algorithim would you use for this situation?

Code:
a[0] = 1
a[1] = 2
a[2] = 3

then 
a[1] = 0  //if a a[x] = 0 then that value is removed and the following values are moved down

then
a[0] = 1
a[1] = 3
02-25-2009, 02:59 AM#2
Rising_Dusk
Insertion sort is pretty good for most cases. I'd probably use that one.
02-25-2009, 03:08 AM#3
Joker
Can I see an example? The one on wiki, I can't read...
02-25-2009, 03:09 AM#4
Anitarf
What you're describing doesn't sound like sorting at all, but merely removing an element from a list while retaining the order of elements in the list. I would recommend using linked lists for that.
02-25-2009, 03:32 AM#5
ShadowWolf
Yeah, linked lists is the standard solution for that in most programming languages. I don't know how they work in JASS, but C++ has awesome commands that make adding and removing things easily, similar to what you're doing.
02-25-2009, 03:48 AM#6
Ammorth
Might I "link" you to this?
02-25-2009, 03:50 AM#7
Rising_Dusk
Quote:
Originally Posted by Joker
Can I see an example? The one on wiki, I can't read...
I use it in the IDDS, which you can check if you'd like. These guys seem to know what they're talking about, though, so you probably don't actually need a sorting algorithm at all.
02-25-2009, 09:15 PM#8
MaD[Lion]
insertion or quicksort is wat i like