A tuple is a sequence of values. The values can be any type, and they are indexed by integers, so in that respect tuples are a lot like lists. The imp...
分类:
其他好文 时间:
2014-07-16 18:17:44
阅读次数:
213
1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * ...
分类:
编程语言 时间:
2014-07-16 17:45:41
阅读次数:
226
算法思想:分治法,将一个序列分为两部分,分别排序,然后合并已排序序列。算法实现: 1 MERGE_SORT(A,p,r) 2 mid = (p+r)/2 3 MERGE_SORT(A,p,mid) 4 MERGE_SORT(A,mid,r) 5 MERGE(A,p,m...
分类:
其他好文 时间:
2014-07-16 00:56:42
阅读次数:
355
/*A - 二分 基础
Time Limit:15000MS Memory Limit:228000KB 64bit IO Format:%I64d & %I64u
Submit
Status
Description
The SUM problem can be formulated as follows: given four lists A, B, C, D of inte...
分类:
其他好文 时间:
2014-07-15 12:49:41
阅读次数:
223
题意:
n只虫子 m种交配方式 并给出m对交配 问 是否存在基… 0.0
思路:
简单的带权并查集 比POJ上那道食物链基础 而且用二分染色可以水过(由于性别只有两种…)
带权并查集可以利用权值维护不同集合间的“关系”
代码书写时注意getf函数中利用fa[x]更新x和根的关系 merge时注意fy权值利用x、y的权值的计算方法
代码:
#include...
分类:
其他好文 时间:
2014-07-15 12:30:45
阅读次数:
234
this.getSession().update(obj);this.getSession().merge(obj);this.getSession().saveOrUpdate(obj);1. update 和 merge的区别首先在执行更新操作的时候,两者都必须要有idupdate是直接执行up...
分类:
系统相关 时间:
2014-07-15 09:53:33
阅读次数:
285
def Median(t): """中位数""" arr = sorted(t) idx = (len(arr) - 1) / 2 if type(idx) is int: return arr[idx] if type(idx) is float: ...
分类:
其他好文 时间:
2014-07-14 23:49:19
阅读次数:
334
Sort a linked list inO(nlogn) time using constant space complexity.题解:实现一个链表的归并排序即可。主要分为三部分:1.找到中点并返回的函数findMiddle;2.归并函数merge;3.排序函数sortList。数组的findM...
分类:
其他好文 时间:
2014-07-14 20:00:56
阅读次数:
182
action值的含义:
lists 内容数据(文章?)列表
relation 内容相关文章
hits 内容数据点击排行榜
category 内容栏目列表
position 内容推荐位列表...
分类:
Web程序 时间:
2014-07-14 18:18:37
阅读次数:
408
operator.itemgetter函数
operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号(即需要获取的数据在对象中的序号),下面看例子。
a = [1,2,3]
>>> b=operator.itemgetter(1) //定义函数b,获取对象的第1个域的值
>>> b(a)
2
>>> b=operator.item...
分类:
编程语言 时间:
2014-07-14 16:59:58
阅读次数:
229