View unanswered posts | View active topics It is currently Thu Apr 17, 2014 11:33 am






Reply to topic  [ 1 post ] 
Best/most efficient way to sort 2D Arrays? 
Author Message
Novice

Joined: Sun Feb 04, 2007 12:48 am
Posts: 69
Location: Australia
Post Best/most efficient way to sort 2D Arrays?
Hi All,

Is there a command or function to easily sort a 2D array?
For example in the code below, what would be the most efficient way to sort or even just access the array in height order?

Code:
int nDistHeightWidth[5][3] =
{
  {43, 38, 8},
  {10, 45, 4},
  {35, 34, 10},
  {46, 43, 12},
  {39, 24, 18},
};


task main()
{

/*Trying to sort objects by Height order

The ideal outcome (assuming the second column is height) would be

      {39, 24, 18},
      {35, 34, 10},
      {43, 38, 8},
      {46, 43, 12},
      {10, 45, 4},

*/
}


Thanks
James


Thu May 08, 2008 4:02 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.