Method isSorted() takes an integer stack as an argument andreturns true if the stacking elements are large to small in order(i.e., the top element of the stack is the smallest element). Atthe time of the method return, the stack uses one Queue for thesecondary memory location in terms of keeping it received. Completethe underlined part of the next code. Note that the following twomethods convert a stack into a queue and a queue into a stack,respectively. public static void s2q(Stack s,Queue q) { … } public static void q2s(Queue q,Stack s) { … } public static boolean isSorted(Stack s) {     if (s.size() backup = newLinkedList();     backup.add(prev);     while (!s.isEmpty()) {         int curr =s.pop();         ______________;         if (prev > curr) {sorted = false; }         prev = curr;     }     q2s(backup, s);     s2q(s, backup);     q2s(backup, s);     return sorted; } Please solve this problem. thank you 🙂 . . .

"Get 15% discount on your first 3 orders with us"
Use the following coupon
"FIRST15"

Order Now