I currently have a queue that holds a user specified number of structs called Process. Process is made up of a pid, burst, and arrival. I would like to sort the queue by arrival, but I don't have the faintest idea of where to begin. Here is some pseudocode to help illustrate what I'm trying to say:
struct Process{
int pid;
int burst;
int arrival;
};
void function(int numProcesses){
queue<Process> readyQueue;
// The following loop is a shortened version of my code
for(int i=0; i<numProcesses;i++){
readyQueue.push(aProcess);
}
// This is where I need help!
// sort(readyQueue);
}
I'd be appreciative of anyone who could point me in right direction on how to do this, or if it is even possible. Thanks!