- Build a Queue Implementation using a Wrapped LinkedList
- Implement some useful Queue methods
- Implement an application to scan a Stack without destroying it
You are going to implement a Queue using a LinkedList. Once you have constructed the Queue you will need to solve the following problem.
suppose you have a stack S and a queue Q that is initially empty. You will implement a method that uses Q to scan S to see if it contains a certain element X, with the additional constraint that your algorithm must return the elements back to S in their original order. You may only use S, Q, and a constant number of other primitive variables.
- Fork this repository
- Use your LinkedLists from prior assignments.
- Review the Queue ADT in package
edu.isu.cs.cs3308.structures
. Review this interface in order to understand methods which must be implemented, their signatures, and their documentation. - Using this ADT implement the class
LinkedQueue
(which implements theQueue
ADT) in the packageedu.isu.cs.cs3308.structures.impl
static <E> boolean scanStack(Stack<E> stack, E element)
in classStackScan
, which scans a stack to determine if it contains the provided element. Note: the stack must contain the same elements in the same order after the method is complete
When you have completed the assignment (all tests pass) or it is reaching midnight of the due date, make sure you have completed the following:
- Committed all changes to your repo
- Pushed your changes to GitHub
- Tagged your repo as "COMPLETE"
- Pushed the "COMPLETE" tag to GitHub
- Submitted your repository URL to Moodle in the Mission 01 submission section.
- StackScan -- 10 Points
- LinkedQueue -- 22 Points
- Program by contract -- 8
- Style and Documentation -- 10
- The merge, transfer, and reverse methods should be quite similar to those implemented for Stack, but keep in mind the FIFO operation of a Queue.
- The StackScan method will need some planning, keeping in mind the four steps to successful planning. It will help to draw out how this algorithm works on paper first.