Code:
void QuickSortPOI(listPOI *pLeft, listPOI *pRight, listPOI *glava)
{
listPOI *pStart;
listPOI *pCurrent;
elementtypePOI nCopyInteger;
if (pLeft == pRight) return;
pStart = pLeft;
pCurrent = pStart->next;
while (1)
{
if (pStart->value < pCurrent->value)
{
nCopyInteger = pCurrent->value;
pCurrent->value = pStart->value;
pStart->value = nCopyInteger;
}
if (pCurrent == pRight) break;
pCurrent = pCurrent->next;
}
nCopyInteger = pLeft->value;
pLeft->value = pCurrent->value;
pCurrent->value = nCopyInteger;
listPOI *pOldCurrent = pCurrent;
pCurrent = PreviousL(pCurrent, glava);
if (pCurrent != NULL)
{
if ((PreviousL(pLeft, glava) != pCurrent) && (pCurrent->next != pLeft))
QuickSortPOI(pLeft, pCurrent, glava);
}
pCurrent = pOldCurrent;
pCurrent = pCurrent->next;
if (pCurrent != NULL)
{
if ((PreviousL(pCurrent, glava) != pRight) && (pRight->next != pCurrent))
QuickSortPOI(pCurrent, pRight, glava);
}
}
Eto kod funkcije koja mi sortira brojeve.