Linked List Sorting Algorithm
<p>I was working on sorting algorithm for my linked list implementation and wanted to get other people's input/comments/critique. What do you think of it in all aspects, including style?</p>

<p>Cheers,
h4ck.b0x7</p>

<pre><code>void LinkedList::sort()
{
    if (head != 0)
    {
        Node* current = head;
        Node* prev = 0;
        Node* tempNode = 0;
        int changeFlag = 0;
        for (int i = 0; i &lt; length; i++)
        {
            while (current-&gt;next != 0)
            {
                tempNode = current-&gt;next;

                if (current-&gt;value &gt; tempNode-&gt;value)
                {
                    changeFlag = 1;
                    current-&gt;next = tempNode-&gt;next;
                    tempNode-&gt;next = current;
                    if (prev != 0)
                        prev-&gt;next = tempNode;
                    prev = tempNode;
                    if (head == current)
                        head = tempNode;
                    if (current-&gt;next == 0)
                        end = current;
                }
                else
                {
                    prev = current;
                    current = current-&gt;next;
                }
            }
            if (changeFlag == 0)
                break;
            else
            {
                prev = 0;
                current = head;
                changeFlag = 0;
            }
        }
    }
}
</code></pre>
