一、思路
利用栈或者递归来实现链表的倒序
二、代码
/** *倒序输出链表 */ public class Solution2 { public void reverseList(ListNode list) { if(list==null) { return; } reverseList(list.m_pNext); System.out.print(list.m_nKey); } }
一、思路
利用栈或者递归来实现链表的倒序
二、代码
/** *倒序输出链表 */ public class Solution2 { public void reverseList(ListNode list) { if(list==null) { return; } reverseList(list.m_pNext); System.out.print(list.m_nKey); } }