继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

剑指offer

慕工程3455409
关注TA
已关注
手记 318
粉丝 77
获赞 293

         

package jianzhiOffer;/** * 输入一个链表,反转链表后,输出链表的所有元素。 * @author user * 思路:使链表的所有节点都指向上一个结点 */public class ch15 {	public ListNode ReverseList(ListNode head) {		ListNode pre = null;		ListNode next = null;		while(head != null) {			next = head.next;			head.next = pre;			pre = head;			head = next;		}		return pre;    }}


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP