HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Array questions part II

02-05-2008, 01:09 PM#1
chobibo
Good Day everyone! Again I ask for your guidance lol. Now for the question: Is sorting array elements feasible/recommendable in jass? Thanks guys.
02-05-2008, 02:22 PM#2
Vexorian
feasible yes, "recommendable" ? I would say that depends on the algorithm in question...
02-05-2008, 02:48 PM#3
chobibo
Well I was thinking of using a Binary search to look for elements, and sort elements upon insertion(Ascending order). Another question: would it get messed up if a sorting procedure was active and I searched the array? I'm having doubts about it.
02-05-2008, 03:08 PM#4
Vexorian
Quote:
Another question: would it get messed up if a sorting procedure was active and I searched the array? I'm having doubts about it.

what are you talking about?
02-05-2008, 03:10 PM#5
cohadar
heapsort.
02-05-2008, 03:28 PM#6
chobibo
Sorry about the unclear question, What would happen if the array insertion and array searching happened simultaenously? would I have an error?
Scenario:
game-time: 1.21; element inserted into the array and sorting procedure (or function) was invoked.
game-time: 1.25; A function accessed and searched the Array to look for an element.

@ cohadar: I don't know what a heapsort is, i don't even know what a heap is lol.
02-05-2008, 03:33 PM#7
Vexorian
Quote:
What would happen if the array insertion and array searching happened simultaenously? would I have an error?
Scenario:
They cannot happen simultaneously, unless you do silly things like placing waits or things that trigger other triggers inside your procedures...
02-05-2008, 03:51 PM#8
chobibo
Thanks man!