1
Orionss
8y

I'm searching how to reverse a linked list in C, I don't have any idea...

Comments
  • 0
    One potential solution could use recursion. This is a potential algorithm off the top of my head. Essentially your base could be when the next nodes next ptr is NULL, then you swap the next nodes next to be the current node and return a reference to the current nodes next pointer. As you go back up the stack, you can do the necessary pointer manipulation... This sounds like a a HW question, so I'm being purposefully vague, but this is close to a solution. It probably isn't the best one though. I've saw some good answers on stack overflow about a year or two ago. Also if your school has a CS tutoring center they should be able to help. Best of luck! 👍🏼
Add Comment