Explore the instructor's solution to the challenge as well as alternative ways a correct solution may have been produced.
(light notes ringing)…- [Instructor] Here is my solution.…We'll start by adding a new stack…because we need to keep track of the forward history.…And so, we will do this at line 12.…We'll call it forward stack, fwd_stack.…The next change will be in the menu.…We have to add the forward option.…It will be a third option.…
This goes in line 16.…And the case for the exit option will stay the same,…but we have to change something for option number one…which is when we visit a new URL.…This change consists on emptying the forward stack.…I will do that by creating a new object in line 24.…We can do this by calling the constructor…of the stack class.…
Now, in option two,…we have to push the current address…into the forward stack.…We have to do that right before the pop operation.…This will happen in line 28.…We will do this by calling the push function…in forward stack.…And we will pass the top of the back stack to it.…Now we are ready to implement option number three.…I will do that in line 31.…
In this case,…we have to report if the forward stack is empty.…
- Why the STL is important
- Containers and iterators
- Vectors and lists
- Stacks and dequeues
- Associative containers
Skill Level Advanced
1. The Standard Template Library
2. Vectors and Lists
3. Stacks, Queues, and Deques
4. Associative Containers
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.