Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 1st, 2003, 08:41 AM
NAVData NAVData is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Vienna, Austria
Posts: 3 NAVData User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to NAVData
sortalgorithm of more than one column

Hi,
i search a possibility to sort an array with more than one key (like an ORDER BY X, Y in SQL). I have searched the whole internet after this information, but without any help ...

I have a random-file, with more than 200.000 records. The quicksort-routine for one key is very fast and no problem. But i need more: I have 3 values

ID,LAT,LONG

And now i want to sort the LAT AND!!! the LONG values tougether, because some LAT values are equal.

Hope i found here a answer of my question ... and a solution of my project (which is stopped since over a week, due this problem )

Thanks,
Richard

Reply With Quote
  #2  
Old May 1st, 2003, 09:51 AM
M3xican's Avatar
M3xican M3xican is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Italy -> Naples
Posts: 9 M3xican User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to M3xican
Lightbulb different sort

U have to make a first sort on the first key, then u have to make a second sort on every subgroups generate with the second key and so on...
An example:
the initial matrix
B 3 c
C 2 c
A 1 b
A 3 a
C 1 b
C 3 a
B 1 a
B 2 b

the matrix after the first sort using the first key
A 1 b
A 3 a
B 3 c
B 1 a
B 2 b
C 2 c
C 1 b
C 3 a

the matrix after the second sort using the second key
A 1 b
A 3 a
B 1 a
B 2 b
B 3 c
C 1 b
C 2 c
C 3 a

the final matrix after the third sort using the third key
A 3 a
A 1 b
B 1 a
B 2 b
B 3 c
C 3 a
C 1 b
C 2 c

I hope that now u can restart to coding

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > sortalgorithm of more than one column

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap