stack<int> sortedStack(stack<int> Stack) {
int tmpStack[Stack.size()];
int i=0;
while (!Stack.empty()) {
tmpStack[i++]=Stack.top();
Stack.top();
}
sort(tmpStack, tmpStack+i);
int j=0;
while (j<i) {
Stack.push(tmpStack[j++]);
}
return Stack;
}
stack<int> Stack;
Stack.push(item);
Stack=sortedStack(Stack);
queue<int> sortedQueue(queue<int> Queue) {
int tmpQueue[Queue.size()];
int i=0;
while (!Queue.empty()) {
tmpQueue[i++]=Queue.front();
Queue.pop();
}
sort(tmpQueue, tmpQueue+i);
int j=0;
while (j<i) {
Queue.push(tmpQueue[j++]);
}
return Queue;
}
queue<int> Queue;
Queue.push(item);
Queue=sortedQueue(Queue);
list<int> sortedList(list<int> List) {
int tmpList[List.size()];
int i=0;
while (!List.empty()) {
tmpList[i++]=List.back();
List.pop_back();
}
sort(tmpList, tmpList+i);
int j=0;
while (j<i) {
List.push_back(tmpList[j++]);
}
return List;
}
list<int> List;
List.push_back(item);
List=sortedList(List);
Comments