在解决几何问题时,我遇到了一种称为滑动窗口算法的方法.
无法真正找到任何研究材料/细节.
算法是什么?

这个问题是两个不相交集之间最接近的一对.Upperside图片表达了这个问题.有两种不相交的集合,-x平面中的蓝点,+ x平面中的红点.
我想计算一个蓝点和一个红点之间的最小距离(距离是| y2-y1 | + | x2 - x1 |),我想用二分搜索来找到距离.如何使用二进制搜索这类问题?我只是在表达二元搜索两个不相交的集合.我已经知道了一套,但我不知道两套不相交的套装.
++)使用Delaunay三角剖分可以在线性时间内?(啊,这只是我的好奇心,我想用二分搜索)
下面的代码,我已经编码了一个案例(使用问题解决技术,除和qonquer)和转换为两个不相交的集合.我不明白怎么做两套.示例,提示.好的..请有人帮帮我?
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
/**
test input
10
-16 -4
-1 -3
-9 -1
-4 -10
-11 -6
-20 4
-13 6
-3 -10
-19 -1
-12 -4
10
8 2
10 3
10 10
20 -3
20 3
16 2
3 -5
14 -10
8 -2
14 0
10
-3 39
-2 …Run Code Online (Sandbox Code Playgroud) P := {F, Q \ F};
W := {F};
while (W is not empty) do
choose and remove a set A from W
for each c in ? do
let X be the set of states for which a transition on c leads to a state in A
for each set Y in P for which X ? Y is nonempty do
replace Y in P by the two sets X ? Y and Y \ X
if Y is …Run Code Online (Sandbox Code Playgroud) 我做了递归函数,就像
require : L (List[Int])
Run Code Online (Sandbox Code Playgroud)
L模式匹配
Nil => Thread.dumpStack()x :: xs => print(x) + function(xs)Run Code Online (Sandbox Code Playgroud)def function(L : List[Int]) { L match { case Nil => Thread.dumpStack() case x :: xs => print(x + " "); function(xs) } }val l =(1到5).toList // function(l)
所以我认为这个函数在堆栈框架中n次,但它发生一次,我认为这个函数已经找到Nil并打印出异常Thread.dumpStack.
scala编译器是智能还是其他?
我做了重量指导图,就像这样
6
0 3 4 INFINITY INFINITY INFINITY
INFINITY 0 INFINITY 7 INFINITY INFINITY
INFINITY 3 0 5 11 INFINITY
INFINITY INFINITY INFINITY 0 6 3
INFINITY INFINITY INFINITY INFINITY 0 4
INFINITY INFINITY INFINITY INFINITY INFINITY 0
Run Code Online (Sandbox Code Playgroud)
起初,我使用一些整数值表示无穷大,如99或20000.但是当我发现它是错误的时,v5 - > v4必须表达无穷大但表达了一些整数值.
例:从v2到v3的最短路径:v2 v3(长度:200000)
整数是否有任何无穷大值?
我的朋友说〜(1 << 31)但它不起作用
http://cingusoft.posterous.com/install-scala-on-mac-os-x
我改变了.profile并保存.我输入后
来源.profile
起初它可以工作,但在我关闭终端并重新打开后,它不起作用.
我怎么这个问题?
我自己解决了.
我导入scala.math._
并像这样形式打印随机int序列
范围=(1到5)
打印随机int序列(3,2,1,4,5).
如何通过for循环?TT
我研究了32位机器,我知道低于$ 12,%esp等同于弹出%eax和mov $ 0,%eax的三倍。
但是我不知道为什么我们在x86-64机器上使用添加$ 18,%rsp进行启动过程调用,或者使用$ 18,%rsp起始以过程调用开始。
为什么编译器使用此规则进行过程调用?争论规则?
0x0000000000400df3 <main+191>: mov $0x402227,%edi
0x0000000000400df8 <main+196>: callq 0x400ab8 <puts@plt>
0x0000000000400dfd <main+201>: callq 0x4014c0 <read_line>
0x0000000000400e02 <main+206>: mov %rax,%rdi
0x0000000000400e05 <main+209>: callq 0x401139 <phase_3>
-----------------------------------------------------------------------
example:
0x0000000000401139 <example+0>: sub $0x18,%rsp
0x000000000040113d <example+4>: lea 0x8(%rsp),%rcx
0x0000000000401142 <example+9>: lea 0xc(%rsp),%rdx
0x0000000000401147 <example+14>: mov $0x40248a,%esi
0x000000000040114c <example+19>: mov $0x0,%eax
0x0000000000401151 <example+24>: callq 0x400ac8 <__isoc99_sscanf@plt>
0x0000000000401156 <example+29>: cmp $0x1,%eax
Run Code Online (Sandbox Code Playgroud) var m_root : Node = root
private def insert(key: Int, value: Int): Node = {
if(m_root == null) {
m_root = Node(key, value, null, null)
}
var t : Node = m_root
var flag : Int = 1
while (t != null && flag == 1) {
if(key == t.key) {
t
}
else if(key < t.key) {
if(t.left == null) {
t.left = Node(key, value, null, null)
flag = 0
} else {
t = t.left
}
} else …Run Code Online (Sandbox Code Playgroud)