题目There 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 b...
分类:
其他好文 时间:
2014-07-27 22:49:39
阅读次数:
176
一 基础知识梳理:并查集(Union-find Sets)是一种非常精巧而实用的数据结构,它主要用于处理一些不相交集合的合并问题。一些常见的用途有求连通子图、求最小生成树的 Kruskal 算法和求最近公共祖先(Least Common Ancestors, LCA)等。使用并查集时,首先会存在一组...
分类:
其他好文 时间:
2014-07-27 22:19:59
阅读次数:
323
并查集的水题,比赛时怎么都AC不了,后来发现是没有考虑先3 2 后1 2的情况,下次注意!#include#include#includeusing namespace std;int x[30010];int k[30010];int num[30010];int find(int y){ ...
分类:
其他好文 时间:
2014-07-27 22:18:59
阅读次数:
228
贪心+并查集fighting~~~~~!! 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 300 7 #define INF 0x3fffffff 8 int par[maxn]; ...
分类:
其他好文 时间:
2014-07-27 21:36:35
阅读次数:
182
Description
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.
The graph G is an ordered pair (V, E), where V is a set of vertices {v1,
v2, …, vn}...
分类:
其他好文 时间:
2014-07-27 11:48:33
阅读次数:
312
UVA 11987 - Almost Union-Find
题目链接
题意:给定一些集合,操作1是合并集合,操作2是把集合中一个元素移动到另一个集合,操作3输出集合的个数和总和
思路:并查集,关键在于操作2,对于并查集,要去除掉一个结点,如果该结点不是根那就好办了,那么就多开n个结点,每个结点初始父亲都是它的i + n,这样在移动的时候,就不用担心他是根结点了剩下就是普通的带权并...
分类:
其他好文 时间:
2014-07-27 11:21:52
阅读次数:
192
我的需求的,文章要选择封面,用查找带回实现,看了查找带回函数bringBack的代码发现,都是针对input 标签处理的,所以img标签始终不能显示,所以对dwz的源代码做了修改,在dwz.databases.js 中找到函数bringBackSuggest,增加代码如下代码即可:$box.find(":img").each(function(){
var $input = $(this)...
分类:
其他好文 时间:
2014-07-27 11:16:52
阅读次数:
239
故障:
之前phpMyAdmim和Yii连接Mysql都好着的,某天,同时出现如下报错:
1、linux下phpMyAdmin 出现 “缺少 mysqli 扩展,请检查
PHP 配置。”
2、Yii 出现CDbConnection failed to open the DB connection: could not find driver
排查:
1、先排查Mysql服务是否正...
分类:
数据库 时间:
2014-07-27 11:16:42
阅读次数:
232
从官方网站上下载的安装包,双击安装即可。新建项目编译时,出现错误:cannot find -lGL 解决的方法:安装libgl1-mesa-dev,当然在安装时会安装其他的一些依赖包
分类:
系统相关 时间:
2014-07-27 11:02:22
阅读次数:
227
题目:Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtim....
分类:
编程语言 时间:
2014-07-27 10:46:02
阅读次数:
294