Assignment 3 – List, Stack and Queue

computer science

Description

CS 2336.004 Spring 2017

Assignment 3 – List, Stack and Queue


March 7th, 2017

Please include comments in all of your code. Describe what your function does, and describe

anything that is tricky or unclear.

Problem #1:

Write a simple Java method (C Function) that moves all of the contents of a stack onto a queue.

Use only the standard operations that apply to each ADT. (In other words, use push, pop, etc. for

a stack. Use enqueue, dequeue, etc. for a queue.)

Problem #2:

Write a simple method that moves all of the contents of a queue onto a stack. Use only the

standard operations that apply to each ADT.

Problem #3:

Write a simple method that moves all of the contents of one stack onto another stack without

changing the order. You may use the methods created in problems 1 and 2 if they help. You may

also use the standard operations of any of the ADTs we have studied thus far (lists, queues,

stacks).

Hint: Creating a temporary queue or stack might help.

Problem #4:

Start with a queue and an empty stack. Write a simple method that uses the stack to reverse the

order of the entries on the queue. (Your final answer should be stored on the queue.) You may

use the methods created in problems 1, 2, and 3 if they help. You may also use the standard

operations of any of the ADTs we have studied thus far (lists, queues, stacks).


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.