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: Best data type to use when sorting data?
Topic Summary:
Created On: 3-Nov-2006 18:16
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.
 3-Nov-2006 18:16
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

What is the best data type to use to store this data?

Take for example I have this data set...

Mary 12
Tom 13
Keri 11
Pete 10

I will create two arrays: one for the name and one for the age. The reason I am creating arrays is to sort the names in alphabetic order.

Array nameArray = create(1,4)
Array ageArray = create(1,4)

Now, would you recommend using Arrays for sorting or something else?

Thanks,

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 3-Nov-2006 20:00
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Skip lists are automatically sorted when you retrieve them. Try the attached.
Report this to a Moderator Report this to a Moderator
 3-Nov-2006 20:09
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

Thanks Louie.

I have looked at skip lists before, and they are great. I enjoy how I can have a custom value for a key.

With the data set I provided how can I make a skip list to have more than one data item such as 3?

For example....

key1 ..... data1 .... data2 ..... data3


Now that I think of it I think three skip lists have to be used.

One for data1 and then one for data2 and lastly one for data3. Then I need to make sure the data in the skip lists are kept consistent since a skip list automtically disgards a duplicate key within one skip list.

-------------------------
pete.kowalski(at)motorola.com

Edited: 3-Nov-2006 at 20:15 by Pete Kowalski
Report this to a Moderator Report this to a Moderator
 6-Nov-2006 08:03
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

A solution is to use a skip for sorting, with the data being the index into an array, where you store all the other data. That way, the data remains consistent to the source without having to worry about duplicates.

Paul

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
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.