#1
|
|||
|
|||
C++ Help
Hi all, I really feel like I'm cheating but I need help. I have a C++ class which is my first programming class. Well I have missed most of this semester so far. My roommate moved out without notice and I haven't received my financial aid yet. He left me with huge bills and without his share of rent. I have been forced to pick up day shifts to pay my bills which is the reason for missing class. This assignment is already 3 days late and I would so appreciate any help given. I have to go work and will be back on later tonight.
These don't seem that hard really but I don't think I fully understand how the teacher wants the algorithm design. In fact from the little I do know about C++ I think I could create the program. I haven't been able to get any notes and don't want to ask him because I don't really want to let on that I haven't been in class because he doesn't take attendance. I don't even really want answers so much as how to properly design the algorithm. Thanks a ton to anyone who feels like throwing a helping hand. Description: In ONE document (Word or OpenOffice), create algorithms to solve the following problems. The algorithms should contain those elements and organization that we have been discussing in class. This includes "top-down" design (i.e. the "outline" approach), title, description, data structures defined in a glossary of variables, and appropriate use of control structures. Problem 2: Construct an algorithm that creates a SIMPLE index for a dictionary. It is SIMPLE because it just consists of the letters of the alphabet and the number of the page on which words that begin with that letter start. (So, your index should have 26 entries ... right?). Problem 3: Given a partial class roll (alphabetized, of course) and a list of students that have added the class late, create a new list of names that contains both lists (alphabetized, of course). |
#2
|
|||
|
|||
Re: C++ Help
#2: You could read the first and last word on each page and note when there is a change of letter during the page (or from one page to the next). Consider skipping a few pages and only doubling back (binary search) if you've overshot the letter change to reduce the amount of work required.
#3: Take each new student name in turn and scan through the main list to find the last entry that precedes it alphabetically. You could reduce the amount of work a little here by sorting the list of new students alpahbetically first, so you don't have to scan the main list from the start each time (only from the point of your last insertion). In both cases be sure to cover every eventuality (eg, dictionary contains no words beginning with a particular letter, or two students have the same name etc etc.) |
|
|