Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java, (if possible limit API use please) 2. Implement insertion (or push) and deletion or pop) for a stack and a circular queue with length
java, (if possible limit API use please) 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. Uutput: 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
java, (if possible limit API use please)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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