刚收到短信通知 485 RFE TSC,求祝福, 谢谢大家# EB23 - 劳工卡
j*4
1 楼
估计挂了,有一题基本不知道怎么解。
设计一个function: bool cancall(), 保证每秒钟内return true的数量小于 N,
想了两个办法,
a)写个queue, 每次 call 把 request time放到queue 里面,dequeue 1秒以前的
request.然后看queue的size..没效率,被否。
b)每秒一个bucket,然后保证当前bucket,的count小于N/2,不精确,被否。
然后就没时间了,这个怎么搞,到底? 提示是"keep track of available count
instead... "
面试管好像说是一个XXX algorithm,在network里面用的。有人听着耳熟么? 我是不是
被黑了。
设计一个function: bool cancall(), 保证每秒钟内return true的数量小于 N,
想了两个办法,
a)写个queue, 每次 call 把 request time放到queue 里面,dequeue 1秒以前的
request.然后看queue的size..没效率,被否。
b)每秒一个bucket,然后保证当前bucket,的count小于N/2,不精确,被否。
然后就没时间了,这个怎么搞,到底? 提示是"keep track of available count
instead... "
面试管好像说是一个XXX algorithm,在network里面用的。有人听着耳熟么? 我是不是
被黑了。