May 4, 2002 #1 chachi Programmer May 4, 2002 8 US The following code orders a linked list in ascending order: Code: while (currentPtr != NULL && value > currentPtr->data) { previousPtr = currentPtr; currentPtr = currentPtr->nextPtr; } How might I alter this to sort descending?
The following code orders a linked list in ascending order: Code: while (currentPtr != NULL && value > currentPtr->data) { previousPtr = currentPtr; currentPtr = currentPtr->nextPtr; } How might I alter this to sort descending?
May 5, 2002 Thread starter #2 chachi Programmer May 4, 2002 8 US To answer my own question, just change the greater than symbol to a lesser than symbol. Upvote 0 Downvote