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 ...
分类:
其他好文 时间:
2018-01-20 12:48:31
阅读次数:
95
Sort a linked list using insertion sort. 讲真,很久没做这么累的链表题目了,这道题折腾了我很久,说实话,最后改来改去,自己还是一知半解,这道题折腾了我一天多,实在是累。实在是搞不懂出这道题的人脑子里面究竟在想什么,注意一个问题,这道题和之前链表题目的不同之处在 ...
分类:
其他好文 时间:
2018-01-18 13:33:34
阅读次数:
191
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you ...
分类:
其他好文 时间:
2018-01-17 21:53:25
阅读次数:
153
Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va ...
分类:
其他好文 时间:
2018-01-17 20:17:26
阅读次数:
172
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? ...
分类:
编程语言 时间:
2018-01-16 01:00:25
阅读次数:
153
中缀表达式与后缀表达式的转换和计算 目录 1 中缀表达式转换为后缀表达式 中缀表达式转换为后缀表达式的实现方式为: 代码实现过程如下, 完整代码 1 from linked_list_stack import Stack 2 3 SIGN = {'+': 1, '-': 1, '*': 2, '/' ...
分类:
编程语言 时间:
2018-01-15 00:26:21
阅读次数:
197
链表有环与链表相交判断的 Python 实现 目录 1 有环链表 判断链表是否有环可以参考链接, 有环链表主要包括以下几个问题(C语言描述): 下面为关于有环链表几个问题的具体实现代码, 完整代码 1 from linked_list import LinkedList 2 3 4 def chec ...
分类:
编程语言 时间:
2018-01-14 21:27:43
阅读次数:
328
双链表 / Doubly Linked List 目录 1 双链表 双链表和单链表的不同之处在于,双链表需要多增加一个域(C语言),即在Python中需要多增加一个属性,用于存储指向前一个结点的信息。 完整代码 1 from linked_list import LinkedList, test 2 ...
分类:
编程语言 时间:
2018-01-14 20:23:00
阅读次数:
160
单链表 / Linked List 目录 链表是一种基本的线性数据结构,在C语言中,这种数据结构通过指针实现,由于存储空间不要求连续性,因此插入和删除操作将变得十分快速。下面将利用Python来完成单链表的实现。 1 单链表 不带表头的单链表通常形式如下, 完整代码 1 class Node: 2 ...
分类:
编程语言 时间:
2018-01-14 20:18:39
阅读次数:
292
这是亚麻的OA题 问题描述 Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cy ...
分类:
其他好文 时间:
2018-01-14 16:47:28
阅读次数:
153