avatar
主席:沼气泄漏了# Joke - 肚皮舞运动
l*8
1
A 2-D bounding box can represented as (Xmin, Xmax, Ymin, Ymax). We have a
set of bounding boxes. There is no intersection between any two of the
bounding boxes.

Now we want to insert one bounding box into the bounding boxes set and merge
the intersected bounding boxes if necessary. Two intersected boxes can be
merged into a big box like this:
Xmin = min(Xmin1, Xmin2); Xmax = max(Xmax1, Xmax2);
Ymin = min(Ymin1, Ymin2); Ymax = max(Ymax1, Ymax2);
Design an algorithm to do the insertion.
Example:
Exising bounding boxes set is { (1,4,0,2), (0,2,3,6) }
Bounding box to be inserted: (3,5,1,4)
Result: { (0, 5, 0, 6) }
avatar
m*d
2
avatar
b*u
3
递归。
public static List Insert(List boundBoxs, BoundBox boundBox)
{
List result = new List();
BoundBox bb = null;
int i;
for (i = 0; i < boundBoxs.Count(); i++)
{
bb = Merge(boundBoxs[i], boundBox);
if (bb != null)
{
break;
}
}
result.AddRange(boundBoxs);
if (bb == null)
{
result.Add(boundBox);
}
else
{
result.RemoveAt(i);
result = Insert(result, bb);
}
return result;
}
avatar
D*a
4
真要是能炸死毛腊肉,中国人民得多幸福啊,饿死的几千万,被整死的几百万人都可以
幸免于难了
avatar
l*8
5
看了大概思路是对的。
这个算法复杂度是O(n^2)吧。 有没有更好的算法?

boundBox)

【在 b******u 的大作中提到】
: 递归。
: public static List Insert(List boundBoxs, BoundBox boundBox)
: {
: List result = new List();
: BoundBox bb = null;
: int i;
: for (i = 0; i < boundBoxs.Count(); i++)
: {
: bb = Merge(boundBoxs[i], boundBox);
: if (bb != null)

avatar
c*c
6
嗯,还能多几千万混血儿。最少你外F能早几年。

【在 D*******a 的大作中提到】
: 真要是能炸死毛腊肉,中国人民得多幸福啊,饿死的几千万,被整死的几百万人都可以
: 幸免于难了

avatar
p*2
7

感觉很难比n^2好的。

【在 l*********8 的大作中提到】
: 看了大概思路是对的。
: 这个算法复杂度是O(n^2)吧。 有没有更好的算法?
:
: boundBox)

avatar
D*a
8
怎么成天把外F放嘴边上呢,你妈外F卖逼给黑鬼了吧

【在 c***c 的大作中提到】
: 嗯,还能多几千万混血儿。最少你外F能早几年。
avatar
x*g
9
你能整天把腊肉放嘴边,别人就不能说说外F?
另外,这个明显PA了吧?

【在 D*******a 的大作中提到】
: 怎么成天把外F放嘴边上呢,你妈外F卖逼给黑鬼了吧
avatar
l*k
10
某些同学把外f挂嘴上,某些同学(女)把B挂嘴上。是不是怕别人不知道你的嘴都有什
么功能啊?

【在 D*******a 的大作中提到】
: 怎么成天把外F放嘴边上呢,你妈外F卖逼给黑鬼了吧
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。