I need sort the but not sure how:
class Stack {
data;
top;
constructor() {
this.data = [];
this.top = 0;
}
push(element) {}
pop() {}
}
size() {
peek() {}
isEmpty() {
}
display() {}
}
How do I solve sortQUsingStack
I need to sort input q.display
function sortQUsingStack(q) {
console.log("input: " + q.display());
var st =
while () {
}
console.log("sorted: " + q.display());
}