码迷,mamicode.com
首页 >  
搜索关键字:listnode    ( 1413个结果
leetcode-876
额,快慢指针,单指针是没必要当作题来做的。 /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func middleNode(head *ListNo ...
分类:其他好文   时间:2020-03-23 23:35:00    阅读次数:115
二叉树的前序、中序、后序
1 //前序 2 void preOrderUnRecur(ListNode* head) 3 { 4 cout << "pre-order: "; 5 if (head != NULL) 6 { 7 stack<ListNode*> Stack; 8 Stack.push(head); 9 10 ...
分类:其他好文   时间:2020-03-23 16:49:34    阅读次数:47
83. 删除排序链表中的重复元素
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:编程语言   时间:2020-03-22 01:19:40    阅读次数:66
237. 删除链表中的节点
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:其他好文   时间:2020-03-21 23:09:33    阅读次数:48
反转链表
#include<iostream> #include <stack> #include <algorithm> #include <string> using namespace std; typedef struct ListNode { int data; struct ListNode* n ...
分类:其他好文   时间:2020-03-21 21:21:36    阅读次数:60
python---从尾到头打印链表
```python class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # 返回从尾部到头部的列表值序列,例如[1,2,3] def printListFromTailToHead(... ...
分类:编程语言   时间:2020-03-21 16:16:02    阅读次数:80
61. 旋转链表
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:其他好文   时间:2020-03-20 10:48:21    阅读次数:55
反转链表
题目描述 输入一个链表,反转链表后,输出新链表的表头。 题目详解 递归,先顺序递归到倒数第二个节点。然后以此回归,并设置head.next = null。保证首节点反转变成最后一个节点后的下一个节点为null。 /* public class ListNode { int val; ListNode ...
分类:其他好文   时间:2020-03-18 21:41:47    阅读次数:54
19. 删除链表的倒数第N个节点
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:其他好文   时间:2020-03-15 18:55:57    阅读次数:53
21. 合并两个有序链表
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; ...
分类:其他好文   时间:2020-03-15 18:52:06    阅读次数:51
1413条   上一页 1 ... 16 17 18 19 20 ... 142 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!