这部分讨论 inference 里面基本的问题,即计算 这类 query,这一般可以认为等价于计算
,因为我们只需要重新 normalize 一下关于 的分布就得到了需要的值,特别是像 MAP 这类 query(一般此时 是 的补集,可以理解成为取
只需要将这里一些 sum 换成 max ...
分类:
其他好文 时间:
2014-06-08 22:53:24
阅读次数:
326
这部分讨论 MAP
估计。从某个角度上来说,我们可以将这个问题转换成为前面讨论过的:这样一来我们只需要将原先的 sum-product 换成 max-sum
即可。话虽这么说,我们还是看看 Koller 同学给大家准备了些什么东西。首先是一些复杂性方面的结论,如给定一个 BN 和常数 ,问是否存在 ...
分类:
其他好文 时间:
2014-06-08 22:39:57
阅读次数:
331
本题要求编写程序,计算4个整数的和与平均值。题目保证输入与输出均在整型范围内。输入格式:输入在一行中给出4个整数,其间以空格分隔。输出格式:在一行中按照格式“Sum
= 和; Average = 平均值”顺序输出和与平均值,其中平均值精确到小数点后1位。输入样例:1 2 3 4输出样例:Sum = ...
分类:
其他好文 时间:
2014-06-08 21:58:02
阅读次数:
373
语法概述
下面看一个例子简单过下语法:
例:
sum(sal) over (partition by deptno order by ename) new_alias
sum就是函数名
(sal)是分析函数的参数,每个函数有0~3个参数,参数可以是表达式,例如:sum(sal+comm)
over() 是开窗函数,这是开启分析函数的起点,对于既可作为聚集函数又可作为分析函...
分类:
数据库 时间:
2014-06-08 05:09:07
阅读次数:
329
点击打开链接
题意:给定牛的关系图,求其中一头牛与其他牛关系路程之和sum最小,然后输出 sum*100/(n-1)
floyd求任意两点间的最短路程
注意: inf不能太大,因为 f[i][k] + f[k][j] 做加法时可能会溢出!
#include
#include
const int maxn = 300 + 5;
const int inf = 1<<29;
int...
分类:
其他好文 时间:
2014-06-08 05:07:03
阅读次数:
181
题目
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional el...
分类:
其他好文 时间:
2014-06-08 05:05:47
阅读次数:
268
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means th...
分类:
其他好文 时间:
2014-06-08 04:05:14
阅读次数:
315
求两个排序数组的中位数。这个题可以有以下几个思路:
首先可以想到的是将两个数组merge起来,然后返回其中位数。
第二个是,类似merge的思想加上计数,找到(m+n)/2个数或者其前后的数,这个就可以算出中位数。这个方法对于各种情况需要一一考虑到。
第三个,假设A[k/2-1]<B[k/2-1],那么A[k/2-1]之前的数一定在整个有序数列中(m+n)/2之前。
这里我给出后面两种思路的代码。
代码一( 思路三)...
分类:
其他好文 时间:
2014-06-08 03:44:47
阅读次数:
231
Problem Description
A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.
You are to find all the hat’s words in a dictionary.
In...
分类:
其他好文 时间:
2014-06-08 03:02:14
阅读次数:
323
题目 :Input: numbers={2, 7, 11, 15}, target=9
Output: index1=1, index2=2
解题思路:
给出一个数组合一个数,如果两个数的和等于所给的数,求出该两个数所在数组中的位置。
这个题也挺常见的,就是两个指针,从前后两个方向扫描。但是本题有以下几个需要的点:
1. 所给数组不是有序的;
2. 返回的下标是从1开始的,并且是原来无序数组中的下标;
3. 输入数组中可能含有重复的元素。
好了,把以上三点想到的话,做这个题应该不会有啥问题。
具体方法:把原...
分类:
其他好文 时间:
2014-06-08 02:14:06
阅读次数:
250