a) For this part of the problem, you can assume we are using the immediate updat
ID: 3670121 • Letter: A
Question
a) For this part of the problem, you can assume we are using the immediate update protocol. We saw that UNDOs have to be done right to left i.e. later writes are undone first and then earlier writes. Give an example to show why it should be done this way by doing the following:
i. Find a simple example where it does make a difference whether the UNDOs are done left to right or right to left.
ii. Show what the results will be if the UNDOs are done right to left.
iii. Show what the results will be if the UNDOs are done left to righ
Explanation / Answer
Solution for Question 1:
If we have an idea about double ended quque ..the DQ..
In DQ we will perform read and write operations on both sides..
DQ have two ends one is Rear end and front end..
Rear end will be at right side..we can perfrom both write and delete oprations in read end..so we can perfrom right to left undo operation.
Solution for Question 2:
If we have an idea about double ended quque ..the DQ..
In DQ we will perform read and write operations on both sides..
DQ have two ends one is Rear end and front end..
front end will be at left side..we can perfrom both write and delete oprations in front end..so we can perfrom left to right undo operation.
Any class that implements this interface is responsible for dealing with any underlying undo and redo actions.
Now can instances of the Changeable interface be managed in a way which corresponds to a simple queue'd undo redo function? Ideally, we'd like a user to be able to undo and redo any action in a queue: a user does something and can undo that action. After an undo, a user can redo said action. If a user performs an action after calling undo, the queue is branched and all possible previous redo are not available.
When I hear the word queue, I think liked list. Using a linked list, we can traverse across the list easily saving the current position in the list, and check if we've reached an end so an undo or redo cannot be performed. And what will the list contain? Changeables of course. The manager class below implements this design and will manage Changeables in a custom made linked list, allowing us to monitor when one can undo or redo (when the internal marker has reached an end to the list), and performing those actions appropriately.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.