This programming project should be completed and submitted by Monday of Week 6if you are following the suggested course schedule. It is worth 8% of your final grade. Please refer to the “Assessments...


This programming project should be completed and submitted by Monday of Week 6if you are following the suggested course schedule. It is worth 8% of your final grade. Please refer to the “Assessments Overview” tab for details on submission of your work. Your overall course assessment information is found in your Course Guide.




  1. TheArrayStackimplementation in Chapter 12 uses the top variable to point to the next array position available in the stack i.e. above the actual top of the stack. Modify the array implementation such thatstack[top]is the actual top of the stack. Do not introduce any other counter variables. Make sure your driver demonstrates any method that you modify. (Adapted from PP 12.4.)


    Hint:Start with theArrayStackcode that you completed as part of Lab3. Consider starting top at a value other than 0 and altering where top may be incremented or decremented.




  2. There is a data structure called adrop-out stackthat behaves like a stack in every respect except that the size is fixed. If the stack size isn, the bottom element is lost when then+1element is pushed onto the top. Implement a drop-out stack using links, by modifying theLinkedStackcode that you completed as part of Lab3.


    The driver should create a stack of moderate size (say five) and push on that many String elements consisting of people’s names (include your own). Output the contents of the stack and the results of thesize()andpeek()operations. Push two more elements onto the stack, outputting the contents and the results of thesize()andpeek()operations for each. (Adapted from PP 13.8.)




  3. A double-ended queue, ordeque(pronounced like “deck”), is introduced in Section 14.8. With a deque you can add, remove, or view elements from both ends of the queue. Rather than use the Deque interface supplied by the Java API, design your ownDequeADTinterface (patterned afterQueueADT). Then, implement a deque using links.


    Hint:Start with theLinkedQueuecode that you completed as part of Lab4. Also, each node will need both a next and a previous reference.


    The driver should create a deque of moderate size (say five or six). It should repetitively add elements to the front, and then the rear. For each addition, output the contents of the deque as well as the size, front element, and last element. Then, repetitively remove elements from the deque. For each removal, output the contents of the deque as well as the size, front element, and last element. (Adapted from PP 14.6 and PP 14.7.)



Jun 08, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here