[Po and Shifu are racing each other up the palace stairs.]SHIFU:Are you ready?PO:Ready's my middle name![Po speeds off ahead, and beats Shifu to their...
分类:
其他好文 时间:
2014-08-25 09:52:14
阅读次数:
354
汉诺塔:有三根相邻的柱子,标号为A,B,C,A柱子上从下到上按金字塔状叠放着n个不同大小的圆盘,要把所有盘子一个一个移动到柱子B上,并且每次移动同一根柱子上都不能出现大盘子在小盘子上方,应该怎么移动?
汉诺塔是个非常经典的问题,讲递归时应该都会讲到它。如果我们没有递归的先验知识, 直接去解答这道题,常常会觉得不知道如何下手。用递归却可以非常优美地解决这个问题。
使用递归的一个关键就是,...
分类:
其他好文 时间:
2014-08-25 01:12:43
阅读次数:
218
Use the SSH to build up the tunnel access to other computer can make the communication encrypted and secured, tested on the http service by using the SSH tunnel access...
分类:
数据库 时间:
2014-08-23 19:06:01
阅读次数:
324
为锐捷配置网络ip,以及DNS1.配置IP网关:sudo gedit /etc/network/interfaces静态IP修改配置文件如下改成自己的参数():auto loiface lo inet loopbackauto eth0iface eth0 inet static#pre-up if...
分类:
其他好文 时间:
2014-08-23 17:36:31
阅读次数:
419
使用root用户在/etc/init.d中touch tomcat文件,使用VI编辑脚本内容如下:#!/bin/bash## tomcat ## chkconfig:345 71 71 # description: Start up the Tomcat servlet engine...
分类:
系统相关 时间:
2014-08-23 16:46:41
阅读次数:
307
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should r...
分类:
其他好文 时间:
2014-08-23 11:18:00
阅读次数:
167
setTimeout, 单位是毫秒setTimeout ( time code, timer delay );eg:setTimeout("alert('wake up!')", 100000);The document object表示网页代码本身修改用户窗口(不是整个浏览器)的大小,可以用bod...
分类:
编程语言 时间:
2014-08-23 08:46:10
阅读次数:
200
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function ...
分类:
其他好文 时间:
2014-08-23 02:15:59
阅读次数:
157
```python def is_pamax(name): low = 0 up = len(name)-1 while low < up: if name[low] != name[up]: return False low += 1 up -= 1 return True f = open("D:/names.txt") max_length = 0 for line in f: nam...
分类:
其他好文 时间:
2014-08-23 01:12:09
阅读次数:
383
实现一个栈,除了push和pop操作,还要实现min函数以返回栈中的最小值。
push,pop和min函数的时间复杂度都为O(1)。
看到这个题目最直接的反应是用一个变量来保存当前栈的最小值,让我们来看看这样可行否?
如果栈一直push那是没有问题,入栈元素如果比当前最小值还小,那就更新当前最小值。
可是如果pop掉的栈顶元素就是最小值,那么我们如何更新最小值呢?显然不太好办。...
分类:
其他好文 时间:
2014-08-22 22:38:01
阅读次数:
176