环境:Ubuntu11.10,Python2.7,Mysql5.0.95在Ubuntu终端输入命令安装Python的Mysql模块sudo apt-get
install python-mysqldb就这么简单;运行一下脚本:#!/usr/bin/python#-*-coding=utf-8##im...
分类:
数据库 时间:
2014-05-01 10:54:23
阅读次数:
474
原题地址:http://oj.leetcode.com/problems/lru-cache/题意:设计LRU
Cache参考文献:http://blog.csdn.net/hexinuaa/article/details/6630384 这篇博文总结的很到位。
https://github...
分类:
编程语言 时间:
2014-05-01 10:47:16
阅读次数:
501
原题地址:http://oj.leetcode.com/problems/linked-list-cycle/题意:判断链表中是否存在环路。解题思路:快慢指针技巧,slow指针和fast指针开始同时指向头结点head,fast每次走两步,slow每次走一步。如果链表不存在环,那么fast或者fast...
分类:
编程语言 时间:
2014-05-01 10:33:38
阅读次数:
426
原题地址:http://oj.leetcode.com/problems/linked-list-cycle-ii/题意:如果链表中存在环路,找到环路的起点节点。解题思路:这道题有点意思。首先使用快慢指针技巧,如果fast指针和slow指针相遇,则说明链表存在环路。具体技巧参见上一篇http://w...
分类:
编程语言 时间:
2014-05-01 08:19:31
阅读次数:
340
A_byte_of_Python-v192-for_Python_3.0-中文版.pdf
中的一道题:练习题: 检测一个文本是否为回文应该忽略标点,空格和大小写。 例如”Rise to vote,
sir.”同样是一个回文,但是我们当前的例子无法识别它。你能改善这个例子让它做都这点吗?代码有点挫,莫...
分类:
其他好文 时间:
2014-05-01 06:52:33
阅读次数:
359
原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/题意:将链表中的节点两两交换。Given1->2->3->4,
you should return the list as2->1->4->3.解题思路:这题主要涉及到链表的操作,没什么...
分类:
编程语言 时间:
2014-05-01 06:44:21
阅读次数:
339
原题地址:http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/题意:Given
a linked list, remove thenthnode from the end of list and return its he...
分类:
编程语言 时间:
2014-05-01 06:42:15
阅读次数:
332
#include#include#includeusing namespace std;int
main(){ int n,i; char a[100000]; cin>>a; sort(a,a+strlen(a)); do{
cout<<a<<endl; }while(next_permut...
分类:
其他好文 时间:
2014-05-01 06:20:37
阅读次数:
368
5.1
简单语句表达式语句:表达式+分号;执行表达式并且丢弃求值结果。空语句:当循环的全部工作在条件部分就可以完成的时候会用到。复合语句:花括号括起来的语句和声明即块。语句作用域:
分类:
其他好文 时间:
2014-05-01 05:53:57
阅读次数:
317
1 保留小数点后两位#include cout const char * spilt="/";char
*p;p=strtok(str,spilt);while(p!=NULL){ //cout
#includesort(Rs.begin(),Rs.end());sort(Rs.begin(),Rs...
分类:
编程语言 时间:
2014-05-01 05:05:45
阅读次数:
409