For this first assignment, you will be writing array-based stacks and queues. I will send you an email with the link to the GitHub Classroom assignment that will create your starter repository. The starter repository will have interfaces for the Stack and Queue. You will need to implement ArrayStack and ArrayQueue, which implement those interfaces.
I then want you to implement the breadth-first search in the GraphSearch class and the postfix calculator in RPCalc.
Note that you can't do new E[10]. Instead, do something like the following:
@SuppressWarnings("unchecked") private E[] data = (E[]) new Object[10];
The postfix calculator should evaluate strings with properly formatted postfix expressions using your ArrayStack with the approach discussed in class. Make sure that your ArrayStack works before you start working on this. The function should take strings like "5 3 - x *" along with Maps that give the value of any variables, like Map.of("x", 2.0). In this example, it should return 4.0. You only need to handle the operators +, -, *, and /.
Your approach should be to split the string on spaces, then have a for-each loop go through the result. If the substring is an operator, you pop two values off your stack and push the result of applying the operator. If the substring isn't an operator but is a key in the Map, then push the value for that key onto the stack. If it isn't an operator or a variable, it will be a properly formatted Double, so you can parse it with Double.parseDouble and push the result on the stack.
The breadth-first search should be implemented using your ArrayQueue. Make sure you have tested your ArrayQueue well before you write this. You can waste a lot of time looking for an error in your BFS when the error is actually in your ArrayQueue. The search method is passed the graph as an adjacency list along with the index of the start and end vertices.
I have provided you with a record type that you should use as the contents of the queue, and you need both vertices and the distance to them. You will also need a Set<Integer> to keep track of what vertices you have been to so you don't go to nodes you have already been to.
Put your unit test in the test folder. When you run gradle test it will generate test coverage. That is put in the file app/build/jacocoHtml/csci2320/index.source.html. The number of points you get depends on your coverage of the files where you are adding code. Full points for 95% coverage or better. Half points for 90-95% coverage. Quarter points for 80-90% coverage.
You can run the speed test that I will use by running gradle run and entering "speed". The output will be different at different times and on different computers, but on a given computer you should be able to check when you make changes that make it run faster.