Answered step by step
Verified Expert Solution
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 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 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 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:
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 as its root element.
o Create another LinkedBinaryTree with as its root element.
o Create a third LinkedBinaryTree with as its root element.
o Attach the tree with the as the left child and the tree with the 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 bottomup construction of the tree. You should determine if it is easier to build the tree in a topdown fashion or in a bottomup fashion.
Once you have created the expression tree have your client print out the following:
The literal string that represents the expression, ie:
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 and Code Fragment this is NOT the parenthesize method in Code Fragment
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started