Re: [Flashcoders] sort 2d array

2007-02-02 Thread Martin Wood-Mitrovski
I think its wise to be careful how you approach this as although quicksort is 'quick' you could actually be using it inefficiently (or rather in a situation that isnt appropriate) If your list is almost sorted then quicksort can be inefficient, (depending on how you choose your pivot, apparent

Re: [Flashcoders] sort 2d array

2007-02-01 Thread Thomas Fowler
e - From: "Thomas Fowler" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, February 01, 2007 12:35 PM Subject: Re: [Flashcoders] sort 2d array /** * @param myArray, sortIndex, left, right * * @usage where myArray is the 2d array you want to sort, sortIndex

RE: [Flashcoders] sort 2d array

2007-02-01 Thread neo binedell
cause array indices are considered as keys just like normal objects. cheers ~neo -Original Message- From: eka [mailto:[EMAIL PROTECTED] Sent: 01 February 2007 07:25 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] sort 2d array Hello :) you must creates benchs to test all solutions bu

Re: [Flashcoders] sort 2d array

2007-02-01 Thread Joshua Sera
Just as a fun thing to do on the side, I'd try researching priority queues, which were designed for exactly this sort of problem. They get used a lot in pathfinding algorithms for games, which probably makes them doubly relevant. --- [EMAIL PROTECTED] wrote: > > > Hello, > > Can anybody tell

Re: [Flashcoders] sort 2d array

2007-02-01 Thread Thomas Fowler
ary 01, 2007 11:08 AM Subject: [Flashcoders] sort 2d array Hello, Can anybody tell me how to sort the following array based upon the second value within each array item myArray:Array = [ [20,40],[20,10],[30,15],[30,35],[40,100],[1000,1]]; this should be something like [[1000,1], [20,10],

Re: [Flashcoders] sort 2d array

2007-02-01 Thread eka
Hello :) you must creates benchs to test all solutions but the first is the sort() method with a custom method var myArray:Array = [ [20,40], [20,10], [30,15], [30,35], [40,100], [1000,1] ]; var compare:Function = function ( a , b ) { if ( a[1] < b[1] ) {

[Flashcoders] sort 2d array

2007-02-01 Thread Kevin . Dowd
Hello, Can anybody tell me how to sort the following array based upon the second value within each array item myArray:Array = [ [20,40],[20,10],[30,15],[30,35],[40,100],[1000,1]]; this should be something like [[1000,1], [20,10], . Faster the better cos its for a game and gets called a l