题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep co...
分类:
编程语言 时间:
2015-01-11 17:39:30
阅读次数:
178
题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or...
分类:
编程语言 时间:
2015-01-10 12:25:37
阅读次数:
204
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al...
分类:
编程语言 时间:
2015-01-10 00:57:36
阅读次数:
327
题目:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e...
分类:
编程语言 时间:
2015-01-09 23:44:17
阅读次数:
237
原题:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen lef...
分类:
编程语言 时间:
2015-01-09 12:22:41
阅读次数:
160
题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL...
分类:
编程语言 时间:
2015-01-09 00:09:55
阅读次数:
301
题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:oj 测试通过Runtime:372 ms 1 # Definition for singly-linked list. 2 # class ListNo...
分类:
编程语言 时间:
2015-01-08 19:37:40
阅读次数:
195
import random
#warning: x and y confusing
sx = 10
sy = 10
dfs = [[0 for col in range(sx)] for row in range(sy)]
maze = [[' ' for col in range(2*sx+1)] for row in range(2*sy+1)]
#1:up 2:down 3:left 4...
分类:
编程语言 时间:
2015-01-08 15:24:22
阅读次数:
158
聚类是一种无监督的学习(无监督学习不依赖预先定义的类或带类标记的训练实例),它将相似的对象归到同一个簇中,它是观察式学习,而非示例式的学习,有点像全自动分类。说白了,聚类(clustering)是完全可以按字面意思来理解的——将相同、相似、相近、相关的对象实例聚成一类的过程。机器学习中常见的聚类算法包括 k-Means算法、期望最大化算法(Expectation Maximization,EM,参考“EM算法原理”)、谱聚类算法(参考机器学习算法复习-谱聚类)以及人工神经网络算法,本文阐述的是K-均值聚类算...
分类:
编程语言 时间:
2015-01-07 16:49:33
阅读次数:
245