由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 这道linkedin题是不是应该用segment tree?
相关主题
interval tree vs. merge intervals大家看看这几道google面试题怎么做?
关于面试中interval tree的问题上个题大家给评评 (G家的)
Merge Interval那道题贡献1个A家3面的面经,被老印坑了
觉得G家很喜欢考interval的题,二爷要不总结一发?这题怎么做啊?
若问OJ的insert interval这题Merge Intervals
请教Merge Intervals 和 Insert Interval空间复杂度的选择。。。。Merge Interval 和 Insert Interval 需要用2分查找先定位到要merge的点么?
问一个题目merge intervals发个fb的面经吧
问个merge interval的变体题G家已挂 分享一下面经
相关话题的讨论汇总
话题: tree话题: segment话题: intervals话题: decide话题: 这道
进入JobHunting版参与讨论
1 (共1页)
J*****v
发帖数: 314
1
Decide whether a target is covered by a list of intervals
J*****v
发帖数: 314
2
还是用merge intervals
s**********g
发帖数: 14942
3
interval tree?
c********t
发帖数: 5706
4
Traveling intervals doesn't work?

【在 J*****v 的大作中提到】
: 还是用merge intervals
J*****v
发帖数: 314
5
可以先merge,再看merged之后的区间没有包含给定的target区间,这样得花o(nlogn)
时间。
不过segment tree往往能给出最好的解法

【在 c********t 的大作中提到】
: Traveling intervals doesn't work?
s**********g
发帖数: 14942
6
segment tree的空间cost未必能太好

【在 J*****v 的大作中提到】
: 可以先merge,再看merged之后的区间没有包含给定的target区间,这样得花o(nlogn)
: 时间。
: 不过segment tree往往能给出最好的解法

c********t
发帖数: 5706
7
哦,target是个区间啊
sort and merge. Then use binary search check. 其实time complexity 是一样的,
space complexity还更好 O(n)。我总觉得segment tree 没什么用。有没有哪道题需要
用segment tree?
A segment tree for a set I of n intervals uses O(n log n) storage and can be
built in O(n log n) time

【在 J*****v 的大作中提到】
: 可以先merge,再看merged之后的区间没有包含给定的target区间,这样得花o(nlogn)
: 时间。
: 不过segment tree往往能给出最好的解法

s**********g
发帖数: 14942
8
leetcode常见题型的话
能用segment tree的题基本都有其他替代品
光说tree就有神马BIT tree啊啥的
但segment tree的确可以灵活解决不少问题
未必能提供面试时的最优solution
但能解决问题 complexity也不差

be

【在 c********t 的大作中提到】
: 哦,target是个区间啊
: sort and merge. Then use binary search check. 其实time complexity 是一样的,
: space complexity还更好 O(n)。我总觉得segment tree 没什么用。有没有哪道题需要
: 用segment tree?
: A segment tree for a set I of n intervals uses O(n log n) storage and can be
: built in O(n log n) time

1 (共1页)
进入JobHunting版参与讨论
相关主题
G家已挂 分享一下面经若问OJ的insert interval这题
facebook面经请教Merge Intervals 和 Insert Interval空间复杂度的选择。。。。
Apple iCloud 电面问一个题目merge intervals
除了某家之外,讨论个F的面试题吧,merge 2D interval问个merge interval的变体题
interval tree vs. merge intervals大家看看这几道google面试题怎么做?
关于面试中interval tree的问题上个题大家给评评 (G家的)
Merge Interval那道题贡献1个A家3面的面经,被老印坑了
觉得G家很喜欢考interval的题,二爷要不总结一发?这题怎么做啊?
相关话题的讨论汇总
话题: tree话题: segment话题: intervals话题: decide话题: 这道