翻转单链表

package day;
/**
 *  翻转单链表
 * @author Administrator
 *
 */
public class ReverseList {
    public static Node reverList(Node head){
        if(head == null || head.next == null){
            return head;
        }
        //递归尽头
        Node h = reverList(head.next);
        //相邻两个节点翻转
        head.next.next = head;
        head.next = null;
        return h;
    }
}
原文地址:https://www.cnblogs.com/caobojia/p/6793850.html