Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with this stacks and queue assignment. Help much appreciated. and please do it the easiest way possible. and dont forget to look for

Please help with this stacks and queue assignment. Help much appreciated. and please do it the easiest way possible. and dont forget to look for the restrictions below

image text in transcribed

MyStack.java Implement a stack using linked lists data structure. Implement your own linked list. You cannot use Java's java.util.LinkedList. . pop): returns and removes the last value on the stack push(String item): Push a given value onto the stack isEmpty): returns true or false depending on if the stack is empty printStack): prints the items on the stack to console Handles errors for all possible edge cases (i.e. doesn't throw an unhandled exception to the user) MyStack(String list): constructor which creates the stack with the items in list on the stack. So if list had {"a"b" c"] the stack would look like: "c" on top of "b" on top of "a. MyQueue.java Implement a queue using the MyStack.java implementation as your data structure. In other words, your instance variable to hold the queue items will be a MyStack class. enqueue(String item): inserts item into the queue dequeue): returns and deletes the first element in the queue isEmpty): returns true or false depending on if the queue is empty printQueue): prints the items in the queue to console MyQueue(String[] list): constructor which creates the queue with the items in list in the queue: So if list had {"a", "b", . C"] the queue would look like: "a" first, then "b", then "c. MyTest.java .You can have other methods in this class but will be graded to have a: Main method which tests every method you implemented above in MyStack and MyQueue. As you test the methods, print to console (1) what you are testing. (2) what value you are expecting, (3) whether your test passed or failed. Test for edge cases and clearly state in your comment/print out which edge case you're testing. Console.pdf This file has the print out from the main method in MyTest.java Also include an answer to the following questions: 1) Show an example screenshot of how you used the debugger in fixing your code with a short description on explaining the bug and how you fixed it. 2) What is the runtime MyStack's push method, in Big O? 3) What is the runtime MyQueue's dequeue method, in Big O? 4) What is the space complexity of MyQueue, in Big O? You will turn in a zip file including the files above as well as your LinkedList implementation used in MyStack

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

2 The main characteristics of the market system.

Answered: 1 week ago