由买买提看人间百态

topics

全部话题 - 话题: interval
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
i**********e
发帖数: 1145
1
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?
你那边有个 while 循环,不知道是不是我以下所说的这个意思。
Treemap 是很好,但是要考虑到这 insert 最坏复杂度是 O(n log n)。
给个例子:
当新的 interval 与第一个 interval 相交,那总共要从 treemap 里删除 n 个
intervals。每删除一次是 log(n) 时间,那总复杂度就是 O(n log n) 了。
照理说,还是一个 vector 好,maintain sorted intervals,然后 in-place 插入,O(n)复杂度。
实现比较麻烦些,不过应该没想象中那么难。我想五十行代码可以写出来,应该是一个
很好的编程练习。
h**o
发帖数: 548
2
来自主题: JobHunting版 - insert interval 没必要二分吧
leetcode 题:Given a set of non-overlapping intervals, insert a new interval
into the intervals (merge if necessary).You may assume that the intervals
were initially sorted according to their start times.
如果输入输出是list, 没法二叉找search,
如果输入输出是array, 没法二叉insert,
所以还是老老实实一个一个scan吧。
怎么面经上有人说用两分哪?

发帖数: 1
3
就是给一堆interval,是在二维平面上的线段。把重合的线段都合并起来。
class Interval {
Point start;
Point end;
}
class Point {
int x; int y;
}
开始是想直接按照斜率和 start.x 排序就好了,结果发现不对,只能维持一个merge好
的序列,for循环往后,对于每个interval,找起点是不是在之前某个interval 组成的
线段上,这样时间复杂度是O(N^2),
各位大神有什么想法?
a*********h
发帖数: 306
4
That is only for 800M. Are you talking about 1m interval?
I got my plan from the following paragraph
When trying to conduct workouts that improve VO2 Max, try to sustain that
pace for approximately 3-4 minutes, which can equate to intervals of 800-
1000 meters. Using the example above (if your 5k PR = 21:42), you’ll want
to plan your VO2 Max workout to run 800-meter intervals at a 3:15-3:20 pace.
Initially try running 3-4 intervals that are 800-1000 meters long at your
VO2 Max pace to start out
b***i
发帖数: 10018
5
来自主题: Running版 - [轻松地爽]6x800m intervals on track
今天去high school track跑6x[800m @ 5k pace + 400m jog]。
心想既然我5k也没这么快,就放慢点跑,前5rep控制在6:00/mi左右就行了。
结果跑下来真是舒服啊,speedstar4很好穿,track很软,心跳很低,跟tempo差不多。
最后一rep提了一下速,2:45跑完了800m,双腿感觉还很新鲜生猛,爽!
Type Dist Time AHR MHR
Interval 0.5 Mi 03:00.3 140 166
Recovery 0.25 Mi 02:28.4
Interval 0.5 Mi 03:01.3 161 169
Recovery 0.25 Mi 02:30.9
Interval 0.5 Mi 03:00.6 162 172
Recovery 0.25 Mi 02:28.8
Interval 0.5 Mi 03:00.6 163 172
Reco
y******n
发帖数: 4527
6
来自主题: Running版 - interval--mile repeat
今天早上醒来很早,不到5点,又挣扎着睡过去,7:30醒来。却突然很懒,于是赖在床
上直到10点。
后起床吃饭收拾衣服,洗个澡去办公室了。本打算将这个星期天的下午和晚上投入到让
我欢喜让我优的工作中去,然后心情沉重的回家睡觉。谁知欢喜的野兽级表现report横
空出世,让我重新有了心潮澎湃的感觉,忍不住在晚饭之前跑回家,换上衣服跑出去,
决定听听自己心跳的声音。
太久太久没跑interval了,查了查自己的report,上次还是四个月前,寒冷的冬夜,在
track上和三个经常一起跑的人跑,被甩的很远。今天决定来个easy interval,也算补
点这周的mileague。
从家后面的trail出发,没石头,都是草,还有一些刺藤。幸好我穿了长裤。沿途看到
兔子无数,如果不是翘起赖的尾巴上的白色,还真是很难辨认出来。热身了2迈,到了
一个足球场,于是在草坪上开始跑interval。
计划的pace是6:20,穿着长裤篮球鞋,又是草坪,这个pace已经不错了。第一迈正好6:
20,不过感觉很累,就是热身没热开的感觉。因为只慢跑了2迈,没有stride。然后慢
跑0.4迈。
第二迈6:24,感... 阅读全帖
m**t
发帖数: 1956
7
来自主题: Running版 - tempo vs interval
关于有氧练有氧,关键是你对待的跑步的态度。我想大部分人都是娱乐+健身为主,对
绝对速度要求不大。就算是那些玩三项和ultra高手,对绝对速度的要求也不是很大;
相反,需要训练身体和大脑在长时间中等强度的持续运动。这样的心态,较慢的跑是不
错的
文章面对是competitive runners,目标是在短时间内最快速的提高,这个要求有训练
的强度。这个是很累的,要不停的测试自己的edge。
关于tempo vs interval,我的经验是,自己的训练好像很难搞到理论上的强度的。比
如我跑 AM55 里面的interval at 5K speed,我观察的自己的心率,最大也就是能推到
92%-93%最大心率。但是5K应该是95%的心率或者更高。tempo如果在平地或者跑步机上
,比较理想的气候下,心率也不会太高。我觉得咱们自己随便练练,自己的训练是很大
水分的。意思是,比如tempo,这个应该在LT左右或者高一点点,但是我猜绝大部分人
tempo都是在LT以下。所以训练的效果很一般。或者说,tempo其实不是tempo,但是
interval还是有点强度的,所以起了一点tempo的作用,... 阅读全帖
r********i
发帖数: 253
8
来自主题: Running版 - 平生第一次跑interval,跪了
What I heard from a coach was LT pace intervals ( 1 mile or 2 mile repeats)
are more beneficial for a marathon training. Speed (fast) pace intervals
should start no early than 8 weeks out of the race day. The key to a good
interval workout is to keep a steady pace and hit the splits precisely.
Calculate your 100m ,200m and 400m splits based on your goal pace. Look at
your watch when you pass the track markers to pace yourself. Sometimes
Garmin not accurate on tracks. I use lap time to track my p... 阅读全帖
d****r
发帖数: 2912
9
我是跑步低手,正在学习中。对照书本结合你这次训练来说说低手的感想。请大拿们指
正。
LZ跑快了或者组间休息短了。
按照Jack Daniels的说法,interval training的目的是为了能在VO2max或者稍慢的速
度下跑足够长的时间。超过vVO2max的速度跑intervals不仅没有必要,而且很可能会降
低训练效果。
“The purpose of an interval session is to accumulatea significant amount of
time running at VO2max, but note that a little less than 100 percent of
maximum can still produce substantial conditioning benefits, so I
have identified the “I zone” as 95 to 100 percent of VO2max (98
-100% maximum heart rate). When running ... 阅读全帖
s**x
发帖数: 7506
10
来自主题: JobHunting版 - interval tree
how to find all the overlapped intervals via augmented interval tree?
google shows a lot weird interval tree implementations not the one mentioned
in CLRS book.
thx!
p*****2
发帖数: 21240
11
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?

这道题我碰到过三次。有些要求
1.自己设计数据结构。所以不一定用List。按道理来说最好的数据结构是interval
tree, 但是面试的时候太难写了。所以Treemap是不错的数据结构。数据结构要能够存
储,merge这些interval,而不应该每次insert都产生一个新的list。
2. interval list可能会非常巨大。因此性能是个问题。TreeMap search, insert,
delete 都是logn的复杂度。如果用list的话,就应该用binary search了。
p*****2
发帖数: 21240
12
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?

这道题我碰到过三次。有些要求
1.自己设计数据结构。所以不一定用List。按道理来说最好的数据结构是interval
tree, 但是面试的时候太难写了。所以Treemap是不错的数据结构。数据结构要能够存
储,merge这些interval,而不应该每次insert都产生一个新的list。
2. interval list可能会非常巨大。因此性能是个问题。TreeMap search, insert,
delete 都是logn的复杂度。如果用list的话,就应该用binary search了。
s*********s
发帖数: 318
13
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?
onsite时碰到这题,要求在list上改。
void insertInterval (vector &intervals, Interval newInterval);
e********2
发帖数: 495
14
来自主题: JobHunting版 - 把n个interval 放到一个container里
起点可以随意移动,但是interval必须在容器内,要求尽可能均匀,有什么好办法没有
?包括近似算法,比如
两个intervals,两个长度都为2,如果起点分别为1和3,i.e.
[1 - 3][3-5]放到容器[1-5]里就是perfectly均匀的。
可以把interval想象成有质量的木板。
o***d
发帖数: 313
15
,danshi 14.3,图14.4.
给的例子是寻找 [22,25]的interval.
如果是寻找[22,26]的interval,其实有两组结果:[15,23],[25,30],但是书中的方法返回
不了第二组???
我哪里看错了么?
多谢
f*********m
发帖数: 726
16
来自主题: JobHunting版 - CLRS上的interval search问题
那复杂度为mlogn,m为overlap的interval数,n为全部interval数。在很多情况下这样
还不如一个一个地和全部Interval比较呢(复杂度总是为n).
a*****3
发帖数: 48
17
merge interval 和 insert interval的区别是什么?
第三题有什么trick么?对每个interval检查一下这个点是否在里面?求教!
s**********1
发帖数: 58
18
来自主题: JobHunting版 - interval tree vs. merge intervals
Interval tree是个动态结果,可以增加删除interval,你说的merge起来的数组是不行
的。其实BST本质就是个动态的有序数组
s*******h
发帖数: 3219
19
很奇怪,用二分法插入新interval 的start值,再用二分法查看要不要merge 该
interval 的end 值to existing intervals 。
在网上没看到有人这么做。难道我想错了?
t**********h
发帖数: 2273
20
来自主题: JobHunting版 - Merge Intervals
Merge Intervals
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
大牛们,这题能O(n)么?想不出啊
r**********o
发帖数: 50
21
Leetcode原题Merge Interval 和 Insert Interval 需要用2分查找先定位到要merge的
点么?
还是顺序扫描?
w*******e
发帖数: 285
22
insert interval 可以用bst,但是merge interval需要顺序扫描吧。
h**o
发帖数: 548
23
来自主题: JobHunting版 - insert interval 没必要二分吧
找到位置没用, 还是要从头把前面的interval一个个加入result, 把新interval加入
result, 再把后面的interval一个个加入result.. 所以还是 O(n)
s*****p
发帖数: 30
24
每个interval 所在的直线都和 x轴有一个交点 (x, 0)(和x轴平行的也要另外考虑)
能不能对于每个interval 计算出这个x的值和, 然后按x和斜率分组。
各个组内 在 interval[(x1, y1), (x2, y2)] 退化成[x1, x2], 然后按照x 排序 再
merge?
w****1
发帖数: 4931
25
来自主题: Running版 - hill intervals
Expecting a small hill early on in the 5K race. So for the first time I did
fast hill intervals. 2 min @ 10mph, 3-
4% incline, followed by 2:00 recovery @ 7mph, 6 reps. On the overall it is
easier than I expected. Running
10mph @ 4% incline is truly "lung busting". Although, now that I'm used to
longer intervals, 2 min is nothing.:)
In the next 7 days I plan to do a serious mile repeat, and another shorter
interval workout at slightly faster
than target race pace.
w****1
发帖数: 4931
26
来自主题: Running版 - 5*600m interval
I never figured out how to display the pace in interval mode either. when I
run intervals on the trail/road, I set the time for each interval and don't
think about my pace. Rather, I set the pace with my breathing. On the track,
of course, I wouldn't need the pace display either.
y******n
发帖数: 4527
27
来自主题: Running版 - Interval today with fast guys
It was really hot today in Cape, more than 80F. (If you want to take it as
BSO, no offense). A group of us is going to do intervals on a trail where
people ride their horses. It is a loop, about half mile long, located in a
park where I have never been before.
I wear the mach11 spikeless to see how it will shorten the distance between
those fast guys and myself. 5 of us showed up and we had a two mile warm up.
Then Chris and Steve draw a line on the trail and said we are going to run
a little mo... 阅读全帖
y******n
发帖数: 4527
28
来自主题: Running版 - Interval induced speedy mid-long
Had an interval on Tuesday. 6*800 @ 5:40 pace, jogging 1:20 in between. Feel
not easy, but not hard either, for a lonely interval.
Had an aerobic run yesterday at 7:50-8:00 pace. Tired this morning before
running to work. Cool and humid.
My body was getting less stiff when I started running. After the first mile,
the pace was immediately elevated to upper end of long run pace with no
intention. Plus I was running on the rolling hills. Finished 9 miles,
shorter than planned distance because I do ... 阅读全帖
M**u
发帖数: 10158
29
来自主题: Running版 - tempo vs interval

还有一类,叫cruise interval
感觉interval有效但是没法坚持,我interval跑一次,大概4-5天都没法跑高质量的,
tempo之后,3天就能恢复了
w********6
发帖数: 12977
30
来自主题: Running版 - Interval workout 咋才能看pace啊?
今天杯具,跑 12x 400米 interval,早上5点多跑了两个高中,一个社区大学,都木有
找到track,唯一一个开放的track居然是烂泥塘。
最后到我跑步的trail用Garmin 305做interval workout,居然只显示有多少feet结束
本次400米,和还有多少lap。 最后稀奇古怪以为做完12个,回家发现少了一个。
跑的我个肺都出来了,喉咙里面感觉有血丝那种味道,腿已经软的不是自己的了,也看
不见pace,回家一查,居然只有6分钟的pace,每次都是最后还没跑完400米就萎靡了。
Garmin Interval Workout 如何看见自己的pace啊,我觉得不知道如何掌握,对于速度
已经完全木有概念。
另外,我这次第一次步频达到204到208之间,感觉已经是我的极限了,看见tuoniao同
学的log,他经常甚至跑7分多的pace,都是200以上,6分钟多的pace,已经是210的步
频了。这都是咋练出来的啊。
y**d
发帖数: 2993
31
来自主题: Running版 - 今早的Interval Run
按照昨天的计划,采用了1-2-2-1的模式
计划是7分半的pace,跑下来差不多是7分10秒,比预想得好点
本来是准备中间cool down 0.5mile的,不过我发觉如果那样的话我就不知道下一个
interval的确切pace了,所以采用了最蠢的办法,中间cool down也是一麦整,这样是
不是太多了?有什么解决办法没有?
跑interval的好处是觉得时间过得特别快,可能是没有那么单调的原因
另外,问一下,interval应该是一周一次还是两次?
多谢!
R*****s
发帖数: 41236
32
来自主题: Running版 - 今早的Interval Run
他这个不算真的Interval, 有点像变种的Tempo, DRF里面叫cruise interval.
AM里面400-1200m的interval, 大约是5K的pace...
R*****s
发帖数: 41236
33
来自主题: Running版 - AM里的100m interval换成什么好?
汗, 那个不叫interval, 叫stride, 就是easyrun 中间快跑个100米, 主要目的是让你
保持一个好的跑姿....最短的interval 大概是 AP里面的200米interval, 跑步机的话,
就跑0.15迈, 休0.1迈,每1迈重复4次..
x******g
发帖数: 2165
34
昨天去outlet的NB店逛了逛,本来想买双MR10的,结果没发现。后来看到了大家推荐的
730。试了一下的确挺宽的,不挤脚。虽然颜色不太好看,但还是买下了。幸运的还是
大使说的第一代。
今天穿着730 在跑步机上练了一个 yond 和变叔推荐的interval。
1 mile warm up
6* 0.75mile @ 8.5 mph (跑步机的速度不准,估计慢5% 左右)
6* 0.25mile @ 6 mph
1 mile cool down.
总共跑了8 miles,一个小时多点。跑到最后一组的时候心跳到了184 正好是95% 的MHR
(193)。
大家看看这个interval训练有什么问题吗?我最后两组开始的时候心跳都150多,是不
是有点太快?
yond 跑全马,练了10组。 我跑半马练六组应该够了吧。
还有一个月跑半马,还能练4次speedwork。 tempo和interval哪个更好一点阿? 一般
tempo需要跑几迈呢?
N******o
发帖数: 3053
35
来自主题: Running版 - interval 训练一问
这个冲刺也太短了吧,而且休息也太长了。400m休息,黄花菜都凉了,400m冲刺,估计
心率都没有被推上去就到了。我跑Interval是0.8mile+0.2mile。看心率图仅仅只是能
维持高心率3分钟。楼主这个应该是前面有人问的HIIT,不能算是Interval。精华区里
面有关于Interval的文章。
f*******n
发帖数: 5241
36
来自主题: Weightlifting版 - Interval Timer
忘了在哪里看到小丸子问Interval Timer的事了,在这里回吧。
据说iPhone有Timer的软件,还挺好用的。不过我没试过。很多电子表也可以设两个不
同时间的Interval Timer的。我的Timex Ironman Triathlon好像就可以,不过我也没
用过。我估计声音太轻,如果锻炼时听音乐,肯定听不到。
http://www.amazon.com/Timex-Womens-Ironman-Triathlon-T5B721/dp/B00020J1GW/ref=sr_1_1?ie=UTF8&s=watches&qid=1262382064&sr=8-1
我还买了个Gymboss,
http://www.gymboss.com/
倒是很好用,不过我只用了一次,放了一阵电池好像没电了?后来也没再试。我发觉最
好用的还是电视。Beachbody的DVD上面都有时间显示,我就放他们的DVD热身,然后做
我自己的Interval练习。
j*****e
发帖数: 182
37
来自主题: Statistics版 - help:question regarding confidence intervals
Note that the solution given by DaShagen is for "credible interval", not for
confidence interval. Do you consider the prob of sucess (p) is a constant
or a random variable? Frequentists view p as a constant. Methodologies for
constructing confidnece intervals is under the frequentist framework.
Your question has been studied by many statisticians and the solutions are
not simple. For more details, please refer to Categorical Data Analysis by
Agresti, 2nd ed, Sec. 1.4.4.
g******n
发帖数: 339
38
来自主题: Statistics版 - 一个confidence interval的问题
The question is: a CI for what?
When people say the confidence interval of x, in general x is a unknown
parameter, say the population mean, not a random variable. 95% CI of Y^2: A
confidence interval of a random variable? It is possible but rarely in the
general context, and in these cases they may have to called by other names
such as the prediction intervals etc.
If a 95% CI of a parameter x =(L,U), then the 95% CI for the parameter x^2=(
L^2, U^2), provided that the transformation x->x^2 is o
a********e
发帖数: 78
39
针对一个数据集建立回归模型后,如何计算 confidence interval 和 prediction
interval. R 里的predict.lm 能够提供这两个指标。这只是针对线性回归的。 但还
有其他
general的模型比如 cart,gam.感觉这两个指标应该是基于bootstrap方法的,但没找
到相关文献。
F**r
发帖数: 84
40
来自主题: JobHunting版 - CLRS interval tree 的两道练习题
14.3-4 is straightforward, directly utilize the properties of interval tree.
14.3-7 straightforward too, apply interval tree in 2-D respectively.

number
time
k*j
发帖数: 153
41
来自主题: JobHunting版 - Interval tree解法
曾经看过一个题。说用到interval tree,有人能帮忙说一下吗?原帖如下。
1) 一个range的序列(链表或数组),如[1,3], [2,6], [8,10],[15,18]
写程序合并有重叠的range,比如上面的序列合并为[1,6], [8,10], [15,18]
如果这个序列不是静态的,而是一个数据流,如何 处理?
=> 后来听说了interval tree,不过还是不太清楚具体如何解决,
有大牛能详细说说么?
i**********e
发帖数: 1145
42
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?
Did you consider the case where the inserted interval may not overlap with
all other existing intervals?
w****x
发帖数: 2483
43
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?

牛哥啊~~ 这都看出来了, 确实没考虑到, 修改后的代码:
//None overlap segments (5,10)(15,17)(18,25),
//insert (16,35), print out merged result:(5,10)(15,35)
bool intersect(int b1, int e1, int b2, int e2)
{
return max(b1, b2) <= min(e1, e2);
}
void PrintMergRes(int a[], int b[], int n, int nBeg, int nEnd)
{
assert(a && b && n > 0 && nBeg < nEnd);
int i = 0;
while (i < n)
{
if (!intersect(a[i], b[i], nBeg, nEnd)) //no intersect
{
//falls between intervals or at first
... 阅读全帖
i**********e
发帖数: 1145
44
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?
Did you consider the case where the inserted interval may not overlap with
all other existing intervals?
w****x
发帖数: 2483
45
来自主题: JobHunting版 - leetcode 这题insert interval怎么做?

牛哥啊~~ 这都看出来了, 确实没考虑到, 修改后的代码:
//None overlap segments (5,10)(15,17)(18,25),
//insert (16,35), print out merged result:(5,10)(15,35)
bool intersect(int b1, int e1, int b2, int e2)
{
return max(b1, b2) <= min(e1, e2);
}
void PrintMergRes(int a[], int b[], int n, int nBeg, int nEnd)
{
assert(a && b && n > 0 && nBeg < nEnd);
int i = 0;
while (i < n)
{
if (!intersect(a[i], b[i], nBeg, nEnd)) //no intersect
{
//falls between intervals or at first
... 阅读全帖
w****x
发帖数: 2483
46
那个是interval tree, 和常说的segment tree不大一样。
好像只能返回一个相交的线段
c*****a
发帖数: 808
47
这题我用merge interval的方法,把新的扔进去,然后做一次merge interval...
会不会有种cheating的感觉
e******i
发帖数: 106
48
来自主题: JobHunting版 - Merge Interval那道题
merge interval 这道题一开始最好需要对各个interval进行排序么
e******i
发帖数: 106
49
来自主题: JobHunting版 - Merge Interval那道题
merge interval 这道题一开始最好需要对各个interval进行排序么
j******2
发帖数: 362
50
来自主题: JobHunting版 - interval tree vs. merge intervals
能举个例子吗?必须用interval tree的
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)