data structure and algothirms
chapter arrays and recurison
please help me out
do the programs in java
The input to all the programs MUST be read from a file and NOT from command line unless specified. A command line should specify asking for the input file name for all the programs. 2. Implement insertion (or push) and deletion (or pop) for a stack and a circular queue with length of n keys as defined in class. An example of input file contents for stack would look like 10 1.push 3.push 5.push pop 2.push and for queue it would look like 13 1. in 3. in 5.in 3. del 2.in. There are two operations for stack and two operations for queue. The first number in both the files indicates the size of the stack and queue respectively. 1. Stack operations: push and pop are the two operations for stack. 3.push - Push value 3 onto the stack, in case of overflow, print OVERFLOW and halt the program. pop - Pops out the first value on the stack and outputs to the console. 2. Circular Queue operations: in and del are the two operations for the circular queue. 3.in - Insert value 3 into the circular queue, in case of overflow, print OVERFLOW and halt the program. del - Deletes the first value at the front of the circular queue. Output: The list before operation and the list after operation displayed on the screen standard outout (not into a file). Example: Input file contents for STACK: 10 1.push 3.push 5.push pop Output of the program should look like: Operation: 1.push List before: EMPTY List after: 1 Operation: 3.push List before: 1 List after: 3 -> 1 Operation: 5.push List before: 3 -> 1 List after: 5 -> 3 -> 1 Operation: pop List before: 5 -> 3 -> 1 List after: 3 -> 1 Input file contents for CIRCULAR QUEUE: 7 1.in 3.in 5.in del Output of the program should look like: Operation: 1.in List before: EMPTY List after: 1 Operation: 3.in List before: 1 List after: 1 -> 3 Operation: 5.in List before: 1 -> 3 List after: 1 -> 3 -> 5 Operation: del List before: 1 -> 3 -> 5 List after: 3 -> 5