Change index in a linked list in c
问题 Can anyone help me with finding an algorithm to change a position of a node in a linked list according to the input? Example: I have the linked list: 1->2->3->4->END and the user chose the second node and the index 4. The algorithm will give us the result: 1->3->4->2->END. Thanks for your help! 回答1: It is really easy to move nodes in a linked list because they are done for that... To change a node's position, just change it's next pointer to the next node address, and the previous node's next