Link List
gx262091291
这个作者很懒,什么都没留下…
展开
-
328. Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in原创 2016-06-25 19:08:12 · 300 阅读 · 0 评论 -
LeetCode 206 单链表逆置
这是一道基本题 时隔一段时间后都值得练习一下Reverse a singly linked list.基本思路:设置三个指针,一个为遍历前驱(游标一) ,一个为遍历后驱(游标二),另一个作为保存节点,保存下一个逆置后指向的位置。代码如下: ListNode* ListReverse(ListNode* L){ if ((NULL == L) || (NUL原创 2016-03-23 14:54:50 · 518 阅读 · 0 评论 -
Leetcode 83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.水题 注意边界和要判断下一个节点/*原创 2016-06-15 18:47:56 · 264 阅读 · 0 评论 -
141. Linked List Cycle 注意边界条件
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Subscribe to see which companies asked this question/** * Definition fo原创 2016-06-16 21:10:45 · 273 阅读 · 0 评论 -
复习指针数组以及如何把二维数组赋值给二维指针
#include #include using namespace std;struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {}};void listadd(){ int flag = 0; ListNode* pre = new ListNode(0); List原创 2017-07-31 00:10:53 · 6084 阅读 · 0 评论