码迷,mamicode.com
首页 >  
搜索关键字:listnode    ( 1413个结果
LeetCode Reverse Nodes in k-Group
class Solution {public: ListNode *reverseKGroup(ListNode *head, int k) { if (k next = rhead; } last = rtail; } ...
分类:其他好文   时间:2014-07-28 11:22:20    阅读次数:227
LeetCode "Remove Nth Node From End of List"
Another Double pointer solution. 1A!class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { ListNode *p = NULL; ...
分类:其他好文   时间:2014-07-23 14:52:16    阅读次数:176
【leetcode刷题笔记】Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:开始想到的方法比较偷懒,直接遍历一遍数组,把每个ListNode对应的值放到...
分类:其他好文   时间:2014-07-22 22:45:13    阅读次数:271
[leetcode]Insertion Sort List
Insertion Sort ListSort a linked list using insertion sort.算法思路:最基本的插入排序,时间复杂度O(n*n),空间复杂度O(1)代码: 1 public class Solution { 2 public ListNode inse...
分类:其他好文   时间:2014-07-22 00:23:34    阅读次数:204
LeetCode "Merge Two Sorted Lists"
Simply care about the boundary cases:class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { if (l1 && !l2) return l1;...
分类:其他好文   时间:2014-07-21 11:07:04    阅读次数:206
20140720
1、链表的反转 #include#includeusing namespace std;typedef struct ListNode{ int data; struct ListNode * Next;}ListNode;ListNode *ReverseList(ListNode *pHead)...
分类:其他好文   时间:2014-07-21 09:34:40    阅读次数:197
链表操作
1链表逆序http://blog.csdn.net/niuer09/article/details/5961004typedef struct tagListNode{ int data; struct tagListNode* next;}ListNode, *List;List Re...
分类:其他好文   时间:2014-07-19 20:28:12    阅读次数:188
011_hasCycle
1 /* 2 * Author :SJQ 3 * 4 * Time :2014-07-16-20.21 5 * 6 */ 7 #include 8 #include 9 #include 10 using namespace std;11 12 struct ListNode {...
分类:其他好文   时间:2014-07-19 13:36:10    阅读次数:166
LeetCode Remove Nth Node From End of List
class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { if (head == NULL) return NULL; ListNode* pre = NULL; ...
分类:其他好文   时间:2014-07-18 18:24:55    阅读次数:209
LeetCode "Remove Duplicates from Sorted List"
The key of this problem is about details especially boundary conditions.class Solution {public: ListNode *deleteDuplicates(ListNode *head) { ...
分类:其他好文   时间:2014-07-18 14:36:54    阅读次数:189
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!