c - Sorting linked list average at end -
i have write function sorts list in specific way, have singly linked list of ints , have find average of numbers in list , put nodes above average @ end of list. can't create new list have work on given list. how can accomplish it?i have this?
- calculate average
- find node above average save data inside , delete
- malloc newnode , add data newnode , link end of list
- repeat?
is method right? somehow unlink given node , add @ end of list deleting , re-creating aren't needed?
Comments
Post a Comment