![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Sort Algorithm Topic Summary: Efficient alphanumeric sort Created On: 28-Jun-2007 13:18 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Quite simple actually. A skip list. Run the code below and you'll see. Just for any Skip List with a string key, always use createString, not create. | |
![]() |
|
Hi, much as I spend most of my day writing dxl code for our database, I'm really a mechanical engineer rather that a Computer Science type. Does anyone have a good algorithm for performing a sort to put a large number of alphanumeric strings in order? Eg 'ABC_123_D_456', ABC_567_D_456 etc. Im guessing there are much faster ways than doing a serial search through all the data for each entry? Many thanks.
------------------------- Andrew Tagg Thales Air Systems, Melbourne Australia. andrew.tagg@thalesatm.com |
|
![]() |
|
![]() |
|
Quite simple actually. A skip list. Run the code below and you'll see. Just for any Skip List with a string key, always use createString, not create.
------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com Edited: 28-Jun-2007 at 13:41 by David Pechacek |
|
![]() |
|
![]() |
|
I use the Skip lists as David suggests: the 'for Key in Skip' loops retrieve in Key sort order. Back to the Skip; I'd be tempted to use the 'DATA' portion of the skip to house 'int' values in the order the values were inserted: put(sortTest, "aaa", 0). That allows you later to retrieve from the skip in insert order (its a little tricky).
But if you need to have an array to house the list then perhaps you need the attached. The huge disadvatage of using an array is that you need to know how big to declare it. - Louie |
|
![]() |
|
![]() |
|
So simple. I'm almost dissapointed. Many thanks guys.
------------------------- Andrew Tagg Thales Air Systems, Melbourne Australia. andrew.tagg@thalesatm.com |
|
![]() |
|
![]() |
|
Be aware that the Skip List technique also removes duplicate values.
|
|
![]() |
|
![]() |
|
True. In my case that's a good thing. but worth remembering.
------------------------- Andrew Tagg Thales Air Systems, Melbourne Australia. andrew.tagg@thalesatm.com Edited: 3-Jul-2007 at 16:33 by Andrew Tagg |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Sort Algorithm
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.