Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Sort Algorithm
Topic Summary: Efficient alphanumeric sort
Created On: 28-Jun-2007 13:18
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by David Pechacek, on Friday, June 29, 2007 2:16 AM

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.
 28-Jun-2007 13:18
User is offline View Users Profile Print this message


Andrew Tagg

Posts: 151
Joined: 26-Oct-2004

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
Report this to a Moderator Report this to a Moderator
 28-Jun-2007 13:40
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Answer 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.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 28-Jun-2007 at 13:41 by David Pechacek
Report this to a Moderator Report this to a Moderator
 28-Jun-2007 23:03
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 29-Jun-2007 02:15
User is offline View Users Profile Print this message


Andrew Tagg

Posts: 151
Joined: 26-Oct-2004

So simple. I'm almost dissapointed. Many thanks guys.

-------------------------
Andrew Tagg
Thales Air Systems, Melbourne
Australia.
andrew.tagg@thalesatm.com
Report this to a Moderator Report this to a Moderator
 2-Jul-2007 22:15
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Be aware that the Skip List technique also removes duplicate values.
Report this to a Moderator Report this to a Moderator
 3-Jul-2007 16:30
User is offline View Users Profile Print this message


Andrew Tagg

Posts: 151
Joined: 26-Oct-2004

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.