|
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?
|