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?

  1. calculate average
  2. find node above average save data inside , delete
  3. malloc newnode , add data newnode , link end of list
  4. repeat?

is method right? somehow unlink given node , add @ end of list deleting , re-creating aren't needed?


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -