码迷,mamicode.com
首页 >  
搜索关键字:python实现    ( 3105个结果
leetcode 【 Copy List with Random Pointer 】 python 实现
题目: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
leetcode 【 Partition List 】python 实现
题目: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
leetcode 【 Swap Nodes in Pairs 】python 实现
题目: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
leetcode 【 Reorder List 】python 实现
题目: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
leetcode 【 Reverse Nodes in k-Group 】 python 实现
原题: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
leetcode 【 Reverse Linked List II 】 python 实现
题目: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
leetcode 【 Sort List 】 python 实现
题目: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
深度优先算法生成迷宫——Python实现
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
Python 实现简单的矩阵
Python 实现简单的矩阵...
分类:编程语言   时间:2015-01-07 18:49:15    阅读次数:644
机器学习经典算法详解及Python实现--聚类及K均值、二分K-均值聚类算法
聚类是一种无监督的学习(无监督学习不依赖预先定义的类或带类标记的训练实例),它将相似的对象归到同一个簇中,它是观察式学习,而非示例式的学习,有点像全自动分类。说白了,聚类(clustering)是完全可以按字面意思来理解的——将相同、相似、相近、相关的对象实例聚成一类的过程。机器学习中常见的聚类算法包括 k-Means算法、期望最大化算法(Expectation Maximization,EM,参考“EM算法原理”)、谱聚类算法(参考机器学习算法复习-谱聚类)以及人工神经网络算法,本文阐述的是K-均值聚类算...
分类:编程语言   时间:2015-01-07 16:49:33    阅读次数:245
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!