Question: Create a NetBeans project. In the project you will do the following: Implement the following data structures: Stack interface ArrayStack LinkedStack Queue interface ArrayQueue LinkedQueue

Create a NetBeans project. In the project you will do the following:

Implement the following data structures:

  • Stack interface
  • ArrayStack
  • LinkedStack
  • Queue interface
  • ArrayQueue
  • LinkedQueue
  • List interface
  • ArrayList

Your code for each of the data structures must be fully commented

1b.

Write a Client class with a main method that tests the data structures as follows:

- For the ArrayStack, LinkedStack, ArrayQueue, LinkedQueue, and ArrayList:

o Perform a timing test for each of these data structures.

o Each timing test should measure in nanoseconds how long it takes to add and remove N Integers from the structure.

o N should vary from 10 to 1,000,000,000 increasing N by a factor of 10 for each test.

o Depending on your system you may run out of memory before you reach the maximum value of N.

If you run out of memory, and your program crashes just decrease the maximum value of N by a factor of 10 and try a new run.

You should see that your program throws an OutOfMemoryError

Generally, you should not try to catch an OutOfMemoryError because your memory space might be corrupted and there is no guarantee that you can recover from the error.

o Test results must be displayed in a nicely formatted ASCII table similar to the examples provided.

o In the ASCII table:

Values in each cell are padded by 2 blank spaces

Each column is just wide enough to display the widest entry in that column including the cell padding. Your program must dynamically adjust the width of each column based on the values that it needs to print.

Numeric values must be printed using the comma thousand separator, i.e.

you must print a large number like 12,345

and not 12345

It is strongly suggested that you create a method that generates and prints the ASCII table. You could pass this method a 2-dimensional array of values that are to be printed.

Future assignments may require that you print out results in a similar ASCII table.

o You should have two final runs in your Word document.

o For the first run, set the max value of N to 1,000,000 so that the times are fairly small.

o For the second run, set the max value of N to 1,000,000,000

o If you run out of memory reduce the max value of N by a factor of 10 and try a new run.

o For this assignment your ASCII tables do NOT need to have column labels

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!