General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
MIT OpenCourseWare
comments
Comments by "" (@pierreollivier1) on "Introduction to Algorithms - Problem Session 1: Asymptotic Behavior of Functions and Double-ended..." video.
you can also use recursion, you return the current node when your next node is equal to NULL, and then you simply assign to your next node->next the address of the current (aka the previous) node. node *list_reverse(node *current, node *next) { if(next == NULL) return (current); list_reverse(next, next->next); next->next = current; return (current); } this is quite efficient, because you itterate the list once and assign also once.
2