Jump to content
  • Advertisement
Sign in to follow this  
ariqs

Accelerated C++ exercise 7-6. What does it mean?

This topic is 4411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not really understanding what the exercise wants. I'm fairly aggravated with it because I'm forcing myself to do all the exercises, and the hardest part seems to be figuring out what he wants with a lot of them. One of the easiest ones I've had so far he labeled difficult to my amusement. "7-6. Reimplement the gen_sentence program using two vectors: One will hold the fully unwound, generated sentence, and the other will hold the rules and will be used as a stack. Do not use any recursive calls." First of all, gen_sentence is a function in the program the generated sentences. Does it want me to change just gen_sentence, or the entire program? I assume the lattter, but I'm not certain. Next, he says using two vectors. Does that mean only two vectors or just two vectors for the gen_aux portion of the program? Finally, what does he mean by using it as a stack?

Share this post


Link to post
Share on other sites
Advertisement
I dunno about the first bits, they're a bit specific to that book. As for a stack, it means to implement the vector as a Last In, First Out (LIFO) data structure (Stack info). Hope that helps...a little.

*edit* Fixed my error. Cheers.

[Edited by - BigFreak on November 15, 2006 4:51:07 AM]

Share this post


Link to post
Share on other sites
Rewording:

Rewrite the program (preferably doing as little work as necessary) without using recursive calls. Hint: you may want to use two vectors to replace the recursion.

Share this post


Link to post
Share on other sites
Guest Deventer
Quote:
Original post by BigFreak
I dunno about the first bits, they're a bit specific to that book. As for a stack, it means to implement the vector as a First In, First Out (FIFO) data structure (Stack info). Hope that helps...a little.

Stacks are a Last In First Out (LIFO) data structure. =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!