Untitled

 avatar
unknown
c_cpp
3 years ago
425 B
6
Indexable
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;
	    }
    }		
}
Editor is loading...