Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
425 B
3
Indexable
Never
void Psort(process PList[])
{
    bool swapped=false;
    int i = 0;
    while (true)
    {
	    swapped=false;
    	for (int i = 0; i<n-1; i++)
    	{
		    if(PList[i].arv > PList[i+1].arv)
		    {
			    process temp = PList[i];
                PList[i] = PList[i+1];
			    PList[i+1] = temp;
			    swapped = true;
		    }
	    }
    
	    if (swapped==false)
	    {
		    return;
	    }
    }		
}