View Single Post
Old Feb 19th, 2008, 10:47 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,869
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Linked Lists: Insertion Sort, RECURSIVELY

Quote:
Originally Posted by jason999x View Post
But InsertSortR should be more clear, I just need to know how to implement it!
InsertSort will be very similar to the psuedocode I posted. Simply compare the value of the current node against the one passed through the function. If it should be inserted before the current node, then create a new node, link it to the next, and return the new node. In the even that the current node is not modified, it should return itself. The calling function should reassign the next node to the return value of the recursion. All done. Want that in psuedocode, or will that ruin the fun?
Sane is offline   Reply With Quote