implement and use the ADT Double-Ended Queue. The assignment is divided into two parts. In the first part, you will implement the ADT DQueue with an augmented set of operations using linked representation. In the second part, you will write methods that use this implementation:
1. Given the following specification of the ADT DQueue, implement this data structure using linked representation. You should write the class LinkedDQueue that implements the interface DQueue.
Specification of ADT DQueue
full (boolean flsag): requires: none. input: none. results: if the number of elements in DQ has reached the maximum then ag is set to true otherwise false. output: ag.
addFirst (Type e): requires: DQ is not full. input: e. results: Element e is added to DQ as rst element. output: none.
addLast (Type e): requires: DQ is not full. input: e. results: Element e is added to DQ as last element. output: none.
removeFirst (Type e): requires: DQ is not empty. input: none. results: Removes and returns the rst element of DQ. output: e.
removeLast (Type e): requires: DQ is not empty. input: none. results: Removes and returns the last element of DQ. output:e.
getFirst (Type e): requires: DQ is not empty. input: none. results: Returns the rst element of DQ. output:e.
getLast (Type e): requires: DQ is not empty. input: none. results: Returns the last element of DQ. output: e.
length (int k): requires: none. input: none. results: Returns the number of elements in DQ. output: k.
reverse (): requires: None. input: none. results: Reverse the order of elements in DQ. output: none.
Example 1. If DQ : A; B; C; D; E, then calling [login to view URL]() results in E; D; C; B; A.
2. Write a class called Expr. In this class, you should implement the following static methods:
(a) public static DQueue<Character> readExpressions(String fileName): A method that
reads in x mathematical expressions from a le fileName and builds an array of double-ended queues, where each expression is represented by one DQueue of char-acters.
File format: assume that the le fileName consists of a sequence of at most 100 expressions, each one in a separate line and can only contain the following opera-tions: +, -, *, / in addition to the parentheses (, ). For simplicity, assume that the numbers are single digit and unsigned, for instance 5, or 6 but not 23, 124 or -4. An example of in x expression is: 3+(2-1)*7. Assume also that there are no spaces within the expression.
(b) public static int evaluateExpression(DQueue<Character> dq, int i): A method that
evaluates the ith expression in dq and returns the calculated value (all operations, "/" in particular, are considered integer operations).
(c) public static boolean reversible(DQueue<Character> dq, int i): A method that checks
if the ith expression is reversible then it returns true otherwise it returns false. A reversible expression gives the same value if it is evaluated from right to left or from left to right. For example: (5+3)*2 is reversible, but (5+3)/2 is not reversible.
Được trao cho:
11 freelancer đang chào giá trung bình $38 cho công việc này
Hello Sir/ Ma’am We are a group of Software Engineers having 10+ years of experience. Expert in java, C, C++ , C# , Android. Please check our profile for reference. Thank you
I am a full time developer and have greate skills in java, javafx, java swing so I can complete this project. My price and time is negotiable. Let's discuss details via chat. I'll provide best service.
Hey A Java expert developer is here I have good advanced expertise in java and Javafx This is an initial bid I can write a program for you as per your need Feel free to message me regards
Strong experience in JAVA software programming High ability to identify and implement process improvements Thorough understanding of Object-Oriented software development and formal development methodologies