Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create your own LinkedStack<E> generic class: Submit just one file LinkedStack.j

ID: 3672559 • Letter: C

Question

Create your own LinkedStack<E> generic class: Submit just one file LinkedStack.java

The Java API uses arrays to implement a Stack, while other languages use linked lists, as it can have be an O(constant) structure if done correctly. In this assignment, I want you to create something similar to the LinkedList in Chapter 16, but FAR shorter, no front & back (just top). Enforce the following:

1. public LinkedStack implements Iterable (no extends allowed).

2. ALL methods in your LinkedStack must be O(constant) complexity.

3. NO System calls in your Class, throw Exceptions if errors occur.

4. Default constructor creates an empty LinkedStack.

5. Follow good coding rules as established back in week #1. Program Submission Requirements

boolean empty()
          Tests if this stack is empty. E peek()
          Looks at the object at the top of this stack without removing it from the stack. E pop()
          Removes the object at the top of this stack and returns that object as the value of this function. E push(E item)
          Pushes an item onto the top of this stack.

Explanation / Answer

Source code:

https://drive.google.com/file/d/0B9P4w87kevGhbzA5MTEydVV0UEU/view?usp=sharing

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote