问题 Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log(m + n)).
分析本题更经...
Problem:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first
two lists.
Solution:
两个有序链表,每次取头部最小的那个元素,然后将这个元素从原来链表...
畅游C++ Boost Serialization 序列化...
mybatis 处理数组类型及使用Json格式保存数据 JsonTypeHandler and ArrayTypeHandler
mybatis 比 ibatis 改进了很多,特别是支持了注解,支持了plugin inteceptor,也给开发者带来了更多的灵活性,相比其他ORM,我还是挺喜欢mybatis的。
闲言碎语不要讲,今天研究了下mybatis的typeHandler:
先看这...
在一个分布式系统中,把所有进程逻辑上组成一个环,首先每个进程知道其下一个进程是谁(通常更常用的应该是每个进程要维护一个记录,知道其后的所有其他进程,以便在其直接后继发生崩溃时,能把令牌传递给其后继,更有甚者传递给其后继的后继);
当环初始化时,进程0得到一个令牌(可以理解为一个互斥锁),该令牌沿着环进行传递,当进程获得到令牌后,会首先检查其是否有访问共享资源的需求,如果需要,则进行资源访问,访问...
前导:开始学习Spring核心思想,通过一个山寨精简版Spring代码结合学习。
内容:1. BeanDefinitionReader-配置读取者。 2. XmlBeanDefinitionReader-从XML中读取配置。 3. Resource-定位资源文件。这次将Bean的配置信息都放到了XML里,所以这里会有一个XML文件的读取,我们通过XmlBeanDefinition...
执行Maven Install打包的时候,出现以下错误信息:[INFO] proguard jar: E:\maven\mvnRespo\net\sf\proguard\proguard-base\5.2\proguard-base-5.2.jar
[proguard] ProGuard, version 5.2
[proguard] java.io.IOException: The same...
public class TimeThread extends Thread
{
private long start;
public volatile boolean exit = false;
public TimeThread(long start)
{
this.start = start;
}
public void run()
{
while(!exit...
python实战-字典使用使用字典统计字符出现次数#! /usr/bin/env python
#coding:utf-8
#定义一个函数,接收字符串,统计出每个字符的出现次数
#实现思路:字典实现,看字符是否在字典中,在则+1,否则计入字典。
def histogram(str):
dic = dict()
for s in str:
if s not in dic...
题目链接:点击打开链接
cdq入门资料:点击打开链接
思路:首先根据上面的ppt可知cdq分治:
solve(l, mid);
计算[l,mid] 对 [mid+1, r] 区间的影响
solve(mid+1, r);
计算影响部分,把询问拆成2个,对x排序后搞搞即可。
#include
#include
#include
#include
#include
#in...