Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in Java - - - - - - Create a client class that does the following: - ArrayStack o Push 1 0 random

Please code in Java ------Create a client class that does the following:
- ArrayStack
o Push 10 random integers onto the stack, printing out each value as it is pushed onto the stack
o Pop the stack until it is empty printing out each value as it is popped off the stack
- LinkedStack
o Repeat the steps done with the ArrayStack
- ArrayQueue
o Enqueue 10 random integers into the queue, printing out each value as it is enqueued into the queue
o Dequeue the queue until it is empty printing out each value as it is dequeued from the queue
- LinkedQueue
o Repeat the steps done with the ArrayQueue
- LinkedPositionalList
o Add 10 random integers into the list, printing out each value as it is added.
o Move forward through the list, staring at the first position and getting each next position using the list iterator, printing the element at each position.
o Move backward through the list using the last and before methods, printing the element at each position.
- LinkedBinaryTree
- Manually creates an instance of a binary expression tree that represents the following expression:
-((9*8)+17)/(14+23)*-2
- Do this by using methods such as attach, set, addRoot, addLeft, and addRight.
- The element should be of type String
- Note that you are manually building this specific expression tree.
- The pseudo code might look something like:
o Create a LinkedBinaryTree with 2 as its root element.
o Create another LinkedBinaryTree with 9 as its root element.
o Create a third LinkedBinaryTree with + as its root element.
o Attach the tree with the 2 as the left child and the tree with the 9 as the right child to the tree with the +.
o You now have a subexpression that can be attached to the expression tree as you build it.
o etc.
The above example implies a bottom-up construction of the tree. You should determine if it is easier to build the tree in a top-down fashion or in a bottom-up fashion.
Once you have created the expression tree have your client print out the following:
- The literal string that represents the expression, i.e.:
((9*8)+17)/(14+23)*-2
- The height of the expression tree
- The preOrder traversal of the tree
- The inOrder traversal of the tree
- The postOrder traversal of the tree
- The breathFirst traversal of the tree
- The parenthesized representation of the tree using Eulers Tour ( section 8.4.6 and Code Fragment 8.29), this is NOT the parenthesize() method in Code Fragment 8.26.
image text in transcribed

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago