Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 109,566 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 1,406 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Alphabetizing A Huge List

 
Reply to this topicStart new topic

Alphabetizing A Huge List

DominationXVI
post 7 Aug, 2008 - 04:42 PM
Post #1


New D.I.C Head

*
Joined: 2 Feb, 2008
Posts: 32

I'm working on a problem from projecteuler.net and I'm not sure how I should tackle the first part. I have a file with around 5000 first names in it and I need to put them in alphabetical order. The names in the file are like this: "WILLIAM","MARY","CHRIS", ..... Anyway, rather than just start off by putting all the names in an array or something, I figured I might try to do the alphabetizing first. Like go thru the file and find the name that is first alphabetically and then store it in an array or vector, and then repeat the process. I don't think this will work to well however, mostly because I wouldn't be removing the names I store in my array from the original list, therefore names I've already ordered alphabetically would still be included in subsequent searches. So I suppose I need to store the names in some sort of container before I start alphabetizing. However say I store all the names in a vector. For comparison purposes I'll need to be able to access each individual letter of the strings in my vector. So i guess I would end up with a two-dimensional vector right?
User is offlineProfile CardPM

Go to the top of the page


AdamSpeight2008
post 7 Aug, 2008 - 05:04 PM
Post #2


D.I.C Addict

Group Icon
Joined: 29 May, 2008
Posts: 506



Thanked 34 times

Dream Kudos: 1900
My Contributions


Here is a very quick way of sorting strings.
BIRST Sorting
If you need help on how it works post back.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 9/7/08 11:33PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month