Write a method “int GetSecondMax(int[] array)” . this method takes an array of integers and returns the second max value Example: if the array contains: 7, 2, 9, 5, 4, 15, 6, 1}. It should return the value: 9
For the Queue use the java interface Queue with the ArrayDeque class
For the Stack use the java Deque interface with the ArrayDeque class
For the LinkedList, use the java LinkedList class
Also, when you are asked to create and use a Queue, you can use only those methods pertaining to the general operations of a queue (Enqueue: addLast, Dequeue: removeFirst, and peek()
Similarly, when you are asked to create and/or use a stack, you can use only those methods pertaining to the general operations of a Stack (push: addFirst, pop:removeFirst, and peek() )
Your code should not only do the job, but also it should be done as efficiently as possible: fast and uses no additional memory if at all possible
Questions
- Write a method “int GetSecondMax(int[] array)” . this method takes an array of integers and returns the second max value
Example: if the array contains: 7, 2, 9, 5, 4, 15, 6, 1}. It should return the value: 9

- Start.
- Read the inputs.
- Perform the operations.
- Print the output.
- Exit.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images









