摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the following co... 阅读全文
posted @ 2015-04-27 22:47 AndyJee 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 逆转链表是简单而又简单的链表问题,其问题的方法之一可以设置三个指针,一个指向当前结点,一个指向前驱结点,一个指向后继指针代码如下:class Solution {public: ListNode* ReverseList(ListNode* pHead) {// if(pHead==N... 阅读全文
posted @ 2015-04-27 21:48 AndyJee 阅读(1749) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.题目要求:合并两个... 阅读全文
posted @ 2015-04-27 21:16 AndyJee 阅读(225) 评论(0) 推荐(0) 编辑