Efficiency of a linked list partitioning algorithm
Yeah, you're missing brackets, but I think I get what you're trying to do. If I'm wrong, ignore this obviously.

printList can just use a for-loop:

void printList(Node *list)
{

 for(Node *temp = list; temp != NULL; temp = temp-&gt;next;)
 {
    cout&lt;&lt;temp-&gt;data&lt;&lt;" ";
 }
} 


Now for the partition function, you're always returning -1 if startPtr == NULL or endPtr == NULL. But you say that those point to what list points to (at the start of the function). In that case, just check if list is null first. Your function won't do anything if it is anyway:

if(list == NULL)
   return -1;


Now in those for-loops, all you have to do is check if startPtr-&gt;next and endPtr-&gt;next == NULL.

In your while loop, you have this code:

if(temp2-&gt;data &lt; pivot)
{
    if(temp != NULL)
        temp = temp-&gt;next;
    else
        temp = startPtr;

    swap(temp-&gt;data, temp2-&gt;data);
}


But what if, for example, temp == NULL and temp2 == startPtr? Assuming swap() does what it says it does, you're unnecessarily swapping values. It might be expensive, and it might not be. I dunno. The function might also do something weird if you try to swap the same exact values. (As a side note,  you're just passing the value of data. If swap doesn't take values by reference, you won't actually be doing anything to temp-&gt;data and temp2-&gt;data).

Also, in the declaration of your while loop, you're not checking for if temp2 == NULL.

while(temp2-&gt;next != endPtr) //This is will throw a Null Pointer Access Violation exception if temp2 == NULL


This could happen, because you aren't checking if temp2-&gt;next == NULL before you say temp2 = temp2-&gt;next. If it ever is, your loop will crash the program. I don't know if it's possible for temp2 to reach the end of the list, but if it is, you should just add a conditional.

After your while-loop, you have:

temp = temp-&gt;next;
swap(temp-&gt;data, endPtr-&gt;data);


That could potentially cause the same problems I described before.

Anyway, these are just suggestions. I didn't check thoroughly to see if there were variables you could remove, though.