码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
[Algorithm] 206. Reverse Linked List
Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? Approach ...
分类:其他好文   时间:2019-12-06 23:28:31    阅读次数:112
图解精选 TOP 面试题 001 | LeetCode 237. 删除链表中的节点
题目描述 原题链接 LeetCode 237. 删除链表中的节点:https://leetcode cn.com/problems/delete node in a linked list 请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点。 现有一个链表 he ...
分类:其他好文   时间:2019-12-01 11:42:08    阅读次数:83
【PAT甲级】1097 Deduplication on a Linked List (25 分)
题意: 输入一个地址和一个正整数N(<=100000),接着输入N行每行包括一个五位数的地址和一个结点的值以及下一个结点的地址。输出除去具有相同绝对值的结点的链表以及被除去的链表(由被除去的结点组成的链表)。 AAAAAccepted code: 1 #define HAVE_STRUCT_TIME ...
分类:其他好文   时间:2019-11-30 21:27:58    阅读次数:119
[LeetCode] 237. Delete Node in a Linked List
Description Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list head = [4,5 ...
分类:其他好文   时间:2019-11-26 13:39:31    阅读次数:53
leetcode 234. 回文链表 java
题目: 请判断一个链表是否为回文链表。 示例 1: 输入: 1->2输出: false示例 2: 输入: 1->2->2->1输出: true进阶:你能否用 O(n) 时间复杂度和 O(1) 空间复杂度解决此题? 解题: /** * Definition for singly-linked list ...
分类:编程语言   时间:2019-11-25 11:18:29    阅读次数:58
20道链表问题
1. 如何在一次传递中找到单链表的中间元素? 答案:http://javarevisited.blogspot.sg/2012/12/how-to-find-middle-element-of-linked-list-one-pass.html 2. 如何在不使用递归的情况下反转单链表? 答案:ht ...
分类:其他好文   时间:2019-11-23 20:27:14    阅读次数:70
leetcode 19.删除链表的倒数第N个节点
给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二个节点后,链表变为 1->2->3->5. 1 /** 2 * Definition for singly-linked list. 3 * p ...
分类:其他好文   时间:2019-11-21 21:27:53    阅读次数:165
<Random>382 380
382. Linked List Random Node class Solution { ListNode node; Random random; /** @param head The linked list's head. Note that the head is guaranteed t ...
分类:其他好文   时间:2019-11-13 09:16:41    阅读次数:71
[LeetCode] 143. Reorder List
链表重排序。题意很简单, Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list's nodes, o ...
分类:其他好文   时间:2019-11-10 15:44:53    阅读次数:66
[LeetCode] 142. Linked List Cycle II
单链表中的环二。题意是给一个链表,如果这个链表中有环,请return环的起点;若没有,return null。找是否有环可以参照[LeetCode] 141. Linked List Cycle的讲解。至于怎么找到环的起点,我这里引用一个非常好的讲解,https://www.cnblogs.com/ ...
分类:其他好文   时间:2019-11-10 10:25:40    阅读次数:96
3784条   上一页 1 ... 25 26 27 28 29 ... 379 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!