码迷,mamicode.com
首页 >  
搜索关键字:random walk    ( 8169个结果)
Python快速排序
快排,取一个key值,一般取第一个即可,将小于key的放到左边,大于key的放到右边,递归实现 1 import random 2 def quicksort(data, low = 0, high = None): 3 if high == None: 4 high = l...
分类:编程语言   时间:2014-09-03 12:48:36    阅读次数:343
重温《STL源码剖析》笔记 第四章
源码之前,了无秘密 ——侯杰第四章:序列式容器 C++语言本身提供了一个序列式容器array array:分配静态空间,一旦配置了就不能改变。 vector: 分配动态空间。维护一个连续线性空间,迭代器类型为:Random Access Iterato...
分类:其他好文   时间:2014-09-03 11:08:36    阅读次数:231
gevent queue应用1
1 # -*- coding:utf-8 -*- 2 #! /usr/bin/env python 3 ''' 4 Created on 2014年9月2日 5 ''' 6 import gevent 7 from gevent.queue import Queue 8 import random....
分类:其他好文   时间:2014-09-02 19:32:15    阅读次数:223
不使用Math.random实现随机数。
var rand = (function(){ var today = new Date(); var seed = today.getTime(); function rnd(){ seed = ( seed * 9301 + 49297 ) % 233280; return ...
分类:其他好文   时间:2014-09-02 17:29:24    阅读次数:145
UVA 10917 - Walk Through the Forest(dijstra)
UVA 10917 - Walk Through the Forest 题目链接 题意:公司编号为1,家编号为2,每次回家都不走回头路,回头路定义为:满足条件的道路(A,B),满足存在一条从B出发比所有从A出发的回家的路径都短,问有几种走法 思路:先从家求dijstra,这样满足条件的道路就是d[A] > d[B],这个图是一个dag,在上面进行dp就可以找出种数了 代码:...
分类:Web程序   时间:2014-09-02 15:51:55    阅读次数:256
HDU-2259-Continuous Same Game (2)(BFS+DFS+模拟)
Problem Description After repeated attempts, LL finds the greedy strategy is very awful in practice. Even there is no apparent evidence to proof it is better than a random one. So he has to drop th...
分类:其他好文   时间:2014-09-02 12:29:04    阅读次数:226
leetcode - Copy List with Random Pointer
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 copy ...
分类:其他好文   时间:2014-09-02 10:19:24    阅读次数:194
英语口语积累随手记----------(2)
小三 mistress / the other woman破坏别人家庭的人 home wrecker耍心机 to scheme跑龙套 、群众演员 extra / walk-on大腕 big shot替身 stunt-double
分类:其他好文   时间:2014-09-02 10:11:34    阅读次数:183
Copy List with Random Pointer
这个题目是深度复制链表,就是所有节点都是新分配的空间,这一点不难做到,难的是新链表random指针的赋值,想想也没什么好办法,就用map存储两个链表的映射关系,在第一次遍历时只新建节点,建立链表,令新链表中节点的random值等于旧链表的值。第二次遍历再根据map一一映射。 1 class Solu...
分类:其他好文   时间:2014-09-02 00:08:03    阅读次数:259
UVA - 1156 Pixel Shuffle (置换+模拟)
Description Shuffling the pixels in a bitmap image sometimes yields random looking images. However, by repeating the shuffling enough times, one finally recovers the original images. This should ...
分类:其他好文   时间:2014-09-01 15:39:53    阅读次数:230
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!