Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sorting Strings Example
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MysticVegeta




PostPosted: Mon Oct 24, 2005 1:58 pm   Post subject: Sorting Strings Example

Hi, Sorry if this has been posted before, i looked thoroughly through the results but didnt find an example of code of sorting strings. Please someone bother to put an example, the DWITE is getting closer, so i need to practise it too! Or someone give ideas/pseudocodes to support!, Thanks a lot! 8)
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Mon Oct 24, 2005 2:39 pm   Post subject: (No subject)

It works the same as for numbers, just change the value to a string. If you don't know how to sort numbers look up bubble sort, or any other sort method either here or on google.
MysticVegeta




PostPosted: Mon Oct 24, 2005 6:02 pm   Post subject: (No subject)

nono i know how to sort the numbers. I just wanted to see an example of how its done perfectly. If i am correct, is this how you do it?
1) Add the integer values of word for example (ABC = 65+66+67)
2) Do for all words
3) sort the numbers
4) put the corresponding words for the sorted numbers?

is this the way do it?
Cervantes




PostPosted: Mon Oct 24, 2005 6:33 pm   Post subject: (No subject)

No! That won't get you anywhere! Well, anywhere you want.

Think:
ab = 65 + 66 = 131
ba = 66 + 65 = 131

Which comes first, alphabetically?
beard0




PostPosted: Mon Oct 24, 2005 8:58 pm   Post subject: (No subject)

In Turing, "Hello" < "World" returns true, so you can use the exact same procedure you used to sort numbers, just change the variable type. This is what [Gandalf] was saying.
MysticVegeta




PostPosted: Wed Oct 26, 2005 1:38 pm   Post subject: (No subject)

What the? they had it built in? oh my god! and here i was doing all kind of sorts that zylum or rizzix (not sure) posted in the tutorials. I realize that was silly, and here i was thinking turing was useless, lol (still is) Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: