p******i 发帖数: 1358 | 1 比如说economy(K)显示有9,是这9张卖完了这个bucket就再也木有了,还是以后还会再
出来? |
|
D*****r 发帖数: 6791 | 2 我也看到了……我举的是一本1651年的书,居然败给一本教材了。这还有天理嘛。
不过好像也有点道理,因为bucket的比喻是大俗语,没什么来源。
要提升到“满桶问题”的理论高度需要一些抽象总结。
" |
|
x*r 发帖数: 11073 | 3 写的真好,我也需要一个bucket list,其实我觉得我有一个,只是还需要往上面添加一些 |
|
p**********r 发帖数: 3581 | 4
要是看过电影The Bucket List就不会不知道了。
没文化就是不行,看看人美国农民。 |
|
|
|
|
|
w*******e 发帖数: 6802 | 9 【 以下文字转载自 TrustInJesus 讨论区 】
发信人: SEEKETERNAL (追求永生), 信区: TrustInJesus
标 题: 包子问题:"满桶”(full bucket)问题征答
发信站: BBS 未名空间站 (Wed Mar 30 22:38:40 2011, 美东)
在基督徒信仰中,基督徒荣耀神是一个所谓“满桶”问题。现在征答:
第一,什么是“满桶”问题,其含义和来源是什么?
第二,在荣耀神上为什么说这是一个“满桶”问题,应该该如何理解?
二者都给出好的回答,第一个对的奖励100WB(各50)
二等奖 60 WB
三等奖 40 WB |
|
|
s********f 发帖数: 510 | 11 可以从最简单情况开始考虑:如果密码只有两位,随机给一位,应该怎么做
那么就是随机N次,把N次的结果分类计数。如果有两个bucket,比如是x和y,那么密码
应该是xy或者yx。如果只有一个bucket,比如是x,那密码就是xx。
那么三位密码随机给两位,应该有C(3,2) = 3个bucket.
比如xy, yz和xz,那么密码应该是xyz。
如果是xy, yx, yy,那么密码就是yxy.
但是也有可能是两个bucket,比如xy(bucket count = 2N/3), yy (bucket count = N
/3), 那么三个bucket其实是xy, xy和yy, 密码是xyy.
也有可能是一个bucket,xx (bucket count = N),那么三个bucket其实是xx,xx和xx
,密码是xxx。
六位密码随机给三位,应该有C(6, 3) = 20个bucket。
比如密码是google
那么着二十个bucket是
goo, gog, gol, goe, gog, gol, goe, ggl, gge, gle, oog, ool, ooe, ogl, oge,... 阅读全帖 |
|
a********r 发帖数: 217 | 12 面的是Relevance algorithm engineer职位,两题,烙印面试官,估计挂了。
第一题,是给定array of int,A, 均匀分布到n个buckets,每个buckets里面的数目
是多少。基本就是bucket sort,思路比较容易,找出max 和min, 然后分割为n个
buckets,统计每个bucket里面个数。
第二题,是第一题的一个延伸,问如果每个buckets的上下届是给定的,怎么来求每个
buckets里面的count的。
例如,array A is
1, 200, 52, 2, 4, 1003
bucket的范围为,
1---100
101-- 1000
1001--2000
那么就等价于给你一个range vector, 表示每个bucket的下界, i.e. {1, 101, 1001}
问此时怎么求每个bucket里面元素的个数。
我当时的想法是,对每个array 里面的number,做binary search找出它属于那个
bucket,然后count,然后感觉是不是要sort array,会有帮助,讨论了一会儿,只是
意识到sort ... 阅读全帖 |
|
W*****B 发帖数: 4796 | 13 Preface
If any of the following events should occur:
a peak oil crisis or a World War that results in a significant reduction in
the transportation of food, or
commercial fertilizer becomes scarce or extremely expensive, or
unemployment increases significantly and many families are forced to grow
their own vegetables, or
there is a local, national, or worldwide famine,
then the following information would be extremely valuable to everyone who
has a vegetable garden. The following information wou... 阅读全帖 |
|
h**********9 发帖数: 3252 | 14 I would do as below.
61 buckets -- one for each minute. last bucket is for the current minute.
every hit will increase the counter in current bucket by 1. at the end of
the minute, phase out the oldest bucket and create a new bucket as the
current bucket.
最后一分钟点击量 = bucket[60] + interpolate(bucket[59])
最后一小时的点击量 = interpolate(bucket[0]) + sum(bucket[1] ... bucket[60]) |
|
i****a 发帖数: 36252 | 15 1.
fill the 6L bucket, pour water into 5L bucket until full, empty the 5L
bucket. pour remaining 1L water into 5L bucket.
fill the 6L bucket again, pour water into the 5L bucket until full, empty
the 5L bucket. pour remaining 2L water into the 5L bucket.
fill the 6L bucket again, pour water into the 5L bucket until full, then
what's remain in the 6L bucket is 3L of water. |
|
t******g 发帖数: 3641 | 16 Your Dog Is Watching You
By TARA PARKER-POPE
He knows you've got your eye on him.He knows you’ve got your eye on him.
You may be teaching your dog new tricks, without even trying.
Dogs are constantly learning from the reaction of human owners, picking up
facial cues and anticipating their owner’s behavior, new research suggests.
The findings, published online in the journal Learning and Behavior, show
that dogs essentially are always in training, and help explain how many
owners unknowingly teac... 阅读全帖 |
|
|
|
m*********a 发帖数: 3299 | 19 int largestSibling(int N){
int i,temp,digit;
int bucket[10]; /*create bucket to store of the total number of each 0-9
*/
for (i=0;i<10;i++) bucket[i]=0;/*initiate bucket to 0*/
temp=N;
while (temp){
digit=temp%10;
bucket[digit]++;
temp/=10;
} /*count the number of each digits*/
int j,output=0;
for (i=9;i>=0;i--)
for (j=bucket[i];j>0;j--){
output=output*10+i;
} /*read out the new largest number*/
return output;
}
这个估计不符合要... 阅读全帖 |
|
t*********u 发帖数: 26311 | 20 yes
int largestSibling(int N){
int i,temp,digit;
int bucket[10]; /*create bucket to store of the total number of each 0-9
*/
for (i=0;i<10;i++) bucket[i]=0;/*initiate bucket to 0*/
temp=N;
while (temp){
digit=temp%10;
bucket[digit]++;
temp/=10;
} /*count the number of each digits*/
int j,output=0;
for (i=9;i>=0;i--)
for (j=bucket[i];j>0;j--){
output=output*10+i;
} /*read out the new largest number*/
return output;
}
这个估... 阅读全帖 |
|
p*u 发帖数: 136 | 21 电面写的这段代码,过了。
class Collection
{
public:
T next() {
if (_type == 0)
{
if (_index == 0)
{
_index++;
return _value
}
else
{
throw Exception;
}
}
else
{
while (_index < buckets.size())
{
if (_buckets[_index].hasN... 阅读全帖 |
|
p*u 发帖数: 136 | 22 电面写的这段代码,过了。
class Collection
{
public:
T next() {
if (_type == 0)
{
if (_index == 0)
{
_index++;
return _value
}
else
{
throw Exception;
}
}
else
{
while (_index < buckets.size())
{
if (_buckets[_index].hasN... 阅读全帖 |
|
k***g 发帖数: 166 | 23 一大堆数,要按照第一位拷贝到不同的int array里面,比如:
[37, 57, 653, 12, 52, 501, 91, ...]
->
Bucket 1: [12]
Bucket 3: [37]
Bucket 5: [57, 52, 501]
Bucket 6: [653]
Bucket 9: [91]
考虑用多线程来提高效率
想了两个办法:
1. 把数组分成8等份,用8个线程同时做。问题是写入buckets的时候会引发大量锁操作
2. 用9个线程,各自负责一个bucket,看起来貌似就不需要锁了,不知道是否够快
还有更好的办法吗? |
|
|
f****g 发帖数: 313 | 25 Could we do multi-level bucket sort:
Round 1:
Construct the buckets as int *a[32].
For each number, we place the number into the buckets by the most-right non-
zero bit. For example: 01000000,00000000,00110000,11000000, we link it into
the bucket a[30]. 00000001,00000000,00110000,11000000 => link to bucket a[
24].
Then for each bucket, we could use the same strategy to sort or quick sort(
depends on the number of integers to be sorted).
|
|
a**********k 发帖数: 1953 | 26 Actually we can do some optimization over the classic Map/Reduce:
Let all buckets distributed on N machines as is, each machine counts
the numbers in all buckets, and pass the result to a master machine,
which calculate and figure out which bucket has the median, then,
we need merge the data in that particular bucket to one machine
to finish the remaining job. In this case, we don't need to shuffle the data
in all the buckets as in classic MR, which has the most overhead as
some one pointed out ... 阅读全帖 |
|
s*****n 发帖数: 5488 | 27 在球面上进行NXN的划分。然后把所有的点都投入二维的buckets. 对于一个buckets
和其他8个buckets进行距离计算。如果这个9个buckets里面的点tai多。再次划分这个9
个buckets.用对角线为 n/2划分。则周围8个小buckets的点都是属于pair.从list中取
出,计算list中剩余的不确定点。 |
|
f*****e 发帖数: 2992 | 28 来自主题: JobHunting版 - A家面试题 先用中位数和四分数(三个数过两遍就可以找出来)或者干脆是随机选的elements,
inplace把数组平分成4个子数组,每个子数组有2^20/2^2=2^18个数,然后对每个子数
组做radix sort。radix sort需要与原数组相同大小的额外空间,还需要buckets用来
记录落入bucket里的数的数目。如果用16位counting,要记录2^16个buckets,每个
bucket 4个字节用来记录落在这个bucket的数的数目。算一算正好够了,因为2MB内存
可以存放
buckets 2^16 x 4 =256KB,加额外空间 2^18 x 4 = 2^20 = 1MB。 |
|
w*******e 发帖数: 395 | 29 假设每个数据是4B的int,100B需要400GB的存储,假设一台server有8GB可用的memory
,需要50台机器,另外有一台机器做controller
每台机器用bucket sorting,分成100个bucket,每台机器把每个bucket内数据的个数
报给controller,controller可以决定那个1B数据的边界会落在哪个bucket内
然后每台机器在相应的bucket内继续划分100个bucket,重复上一步,直到找到所有1B
数据为止。
TOP1
HEAP |
|
b*****n 发帖数: 618 | 30 每d个数可以组成一个bucket,
比如d=4,
那么
bucket[1]=[1,2,3,4]
bucket[2]=[5,6,7,8]
。。。
每个bucket最多只能有两个数存在否则就有duplicate,
另外除了要看每个数自己所在bucket之外还要看前边和后边相邻的两个。
用一个hashmap纪录bucket id跟每个数的对应关系。 |
|
Q******o 发帖数: 718 | 31 PAINTED MANTELS: Often, much of the soot on painted mantels can be removed
by using a dry cleaning sponge, such as Mr. Clean Magic Eraser. Just rub in
small circles until soot disappears. For stubborn soot, mix a solution of
warm water and ammonia in a bucket---about 1 cup ammonia to gallon water is
the right proportion. Soak a clean rag in the solution, wring out excess,
and wipe mantel. Let dry, then repeat if necessary.
UNPAINTED BRICK: First, lay down a drop cloth, plastic sheeting or old
t... 阅读全帖 |
|
c******e 发帖数: 355 | 32 paybygroup是两个普林斯顿的party animal办的,主要用于筹资办派对。参与者先集资
,钱够了再开party。有点类似kickstarter+paypal,属于众筹模式的一种。
paybygroup 2011年收到了500 Startups的天使投资,算是正统startup出身,收获了不
少媒体报道,鼎盛时期还传出他们和71个国家的payment gateway建立了合作关系。可
惜,最终还是没有做起来。
因为paybygroup的模式和Buckete有点相似(我们众筹团购,他们众筹party),所以我
特意分析了一下他们。
paybygroup的根本问题在于模式本身:需求太小,市场上代替方案太多。
第一party不是天天开,paybygroup初衷是为大家提供payment split的便利,可是大家
要享受这个convenience,必须先去网站注册支付等走一个繁琐流程,which defeats
the purpose of itself. 因此用户的初始动力不足。
第二他们市场考察不仔细。paybygroup的founder 说他们是为那些互相不认识的party
... 阅读全帖 |
|
m**********n 发帖数: 2894 | 33 谢谢,用油就可以收拾它们,不用药
#1 Earwig Trap
Cut up an old garden hose into 8-inch lengths. To make eco-friendly earwig
traps, dip the hoses into a bucket of plain water. Then, set them all around
your garden at night. In the morning, put a squirt of dishwashing soap in a
bucket. Fill the bucket about three quarters full with warm water; swish
the solution.
Then, head out to your garden to check the earwig traps. As you pick-up each
length of hose, hold it over the bucket and tap on it. The earwigs will
fall... 阅读全帖 |
|
r*********e 发帖数: 29495 | 34 Buckethead的独行侠形象让人印象超级深刻,不仅仅是头顶的这个炸鸡桶,丫的solo实在
是太cool,这个combo是他的一个经典,超喜欢.
这里有老外给他写的一段文章,很神奇的title,研究Buckethead的首席专家
http://www.bucketheadland.com/story/index.html
Narrated by Ronald L. Witherspoon
Bucketheadland Historian
Well every once in a while people ask me about Buckethead. Why does he wear
a mask and bucket. What happened to his parents. Is he part robot, will he h
urt us, is he really Colonel Sanders son, on and on and on. Well I can't tel
l you everything about Bucket but I can tell you... 阅读全帖 |
|
b*****e 发帖数: 474 | 35 if you know the exact flow function f(t), you just need to
focus on the case that a bucket can be just full but never
overflows. Suppose one bucket's water volumn is a function
v(t), then dv/dt = f(t), or v(t) = C + integrate(f(u), u=0..t)).
max of v(t) = bucket volumn V, so you can solve the constant C.
But you have to verify that v(t) never <0. The total volumn of water
in two buckets must >= bucket volumn. (I am assuming the buckets
are identical and V is large enough. It is easy to apply the |
|
m*********a 发帖数: 3299 | 36 for positive integer>0
int i,temp;
int bucket[10]; /*create bucket to store of the total number of each 0-9*/
for (i=0;i<10;i++) bucket[i]=0;/*initiate bucket to 0*/
temp=N;
while (temp){
digit=temp%10;
bucket[digit]++;
temp/=10;
}
上面就要O(N)吧,是吧?
然后从bucket中取值,从大到小 |
|
h**6 发帖数: 4160 | 37 来自主题: JobHunting版 - 再问一道题 前面 bucket sort 的方法是对的,找出最大最小值,然后根据取值范围分成 256 或者 65536 个 bucket ,统计每个 bucket 内的元素个数,得出中位数再哪个 bucket 里面的第几个。如果该 bucket 内元素个数仍然过多,不能放入内存,那么就继续划分,否则可放入内存排序后得出答案。 |
|
j********x 发帖数: 2330 | 38 这都搞笑呢吧。。。
hash table,hash(key)是作为index,插入对应bucket;
query的时候,找到对应的bucket,然后查找对应的key。。。
rehash(应该叫double hashing)只是放到另一个bucket
query的时候先用第一个hash,找到bucket,找key;没有,第二个hash,第二个bucket
,找key,有,return,没有,拉倒。。。
什么跟什么,阿三是生物学毕业的码工吧。。。 |
|
g********t 发帖数: 39 | 39 贡献刚做的online test,职位是Machine Learning related。
Question 1 / 2 (LaserMaze)
You are standing in a rectangular room and are about to fire a laser toward
the east wall. Inside the room a certain number of prisms have been placed.
They will alter the direction of the laser beam if it hits them. There
are north-facing, east-facing, west-facing, and south-facing prisms. If the
laser beam strikes an east-facing prism, its course will be altered to be
East, regardless of what direction it had been goi... 阅读全帖 |
|
M****g 发帖数: 162 | 40 Question 1 / 2 (LaserMaze)
You are standing in a rectangular room and are about to fire a laser toward
the east wall. Inside the room a certain number of prisms have been placed.
They will alter the direction of the laser beam if it hits them. There
are north-facing, east-facing, west-facing, and south-facing prisms. If the
laser beam strikes an east-facing prism, its course will be altered to be
East, regardless of what direction it had been going in before. If it hits
a south-facing prism... 阅读全帖 |
|
s********f 发帖数: 510 | 41 数据结构是一个数组,size 300 (1 sec 1 bucket), 初始化每个bucket都是0.
hitlog: bucket = sec % 300, array[bucket]++
get: return sum of the array
如果需要scale,需要考虑的问题有
1) 数组不能放在单个server上了,需要distributed cache (比如memcache 或者
redis)。
2) 一秒一个bucket是不是导致溢出,可以更精度再小一些,比如10millisec 一个。 |
|
s********f 发帖数: 510 | 42 数据结构是一个数组,size 300 (1 sec 1 bucket), 初始化每个bucket都是0.
hitlog: bucket = sec % 300, array[bucket]++
get: return sum of the array
如果需要scale,需要考虑的问题有
1) 数组不能放在单个server上了,需要distributed cache (比如memcache 或者
redis)。
2) 一秒一个bucket是不是导致溢出,可以更精度再小一些,比如10millisec 一个。 |
|
g*****g 发帖数: 34805 | 43 Practically, I would put the numbers in buckets, say 10 buckets that divides
Integer range, count the numbers in each bucket and figure out which bucket
has the median number. Redistribute the numbers, repeat the process until
the bucket has less than N number and median is in it. This works best if
you know the range and distribution. |
|
r**********n 发帖数: 97 | 44 Bucketize each database and then sum all the buckets. You can find a bucket
which contains the median. You can have a fine grain on this bucket and then
get the median. This requires to scan the whole data twice.
You can definitely do a fine grain bucketization in the beginning but it
takes much more space. |
|
e********3 发帖数: 229 | 45 那可以这样吗?用d-1个数组成一个bucket.这样只要第二个数落进相同的bucket并且
index相差k就是dup.同时还要比较左右两边.算bucket可以用数的值/3得到bucket id然
后作为hashmap的key,value可以用一个node包含这个数的index和value.不清楚为什么
你用d来作为bucket size.是有什么地方我miss了吗? |
|
G***G 发帖数: 16778 | 46 if you go to garden store, the cheapest fertilizer spreader is still on sale
for $15.
Like this one,
it is $35.
Now I introduce a method to make a fertilizer spreader, which costs you
nothing.
Material
milk bucket
tools:
nail
hammer
steps:
1: drink up all the milk
2: drill a dozen of holes at the bottom of the milk bucket using nail and
hammer. If you have a driller, that would make this process much easier.
how to use:
1: open the cap of the milk bucket. Pour the fertilzier into the milk bucket... 阅读全帖 |
|
G***G 发帖数: 16778 | 47 if you go to garden store, the cheapest fertilizer spreader is still on sale
for $15.
Like this one,
it is $35.
Now I introduce a method to make a fertilizer spreader, which costs you
nothing.
Material
milk bucket
tools:
nail
hammer
steps:
1: drink up all the milk
2: drill a dozen of holes at the bottom of the milk bucket using nail and
hammer. If you have a driller, that would make this process much easier.
how to use:
1: open the cap of the milk bucket. Pour the fertilzier into the milk bucket... 阅读全帖 |
|
c******e 发帖数: 355 | 48 这个关键看是谁在组织了,buckete不过是个用来组团的平台。现在u1的价格谈的不错
,差不多可以6000以下了,这个价格比起全美大多数地方来说,都是超级便宜的,你看
看他们现在有的团:
https://www.buckete.com/product/YBD00OYYSD/?tag=mitbbs
另外,dealer当然不喜欢buckete,因为buckete让他们火拼价格的。。。以前dealer投
标的积极性不高,不过现在buckete要求所有买家预付押金的,所以dealer还是忍不住
诱惑会来拍,湾区的话,每个月都有一两个团成团的。 |
|
c******e 发帖数: 355 | 49 这个关键看是谁在组织了,buckete不过是个用来组团的平台。现在u1的价格谈的不错
,差不多可以6000以下了,这个价格比起全美大多数地方来说,都是超级便宜的,你看
看他们现在有的团:
https://www.buckete.com/product/YBD00OYYSD/?tag=mitbbs
另外,dealer当然不喜欢buckete,因为buckete让他们火拼价格的。。。以前dealer投
标的积极性不高,不过现在buckete要求所有买家预付押金的,所以dealer还是忍不住
诱惑会来拍,湾区的话,每个月都有一两个团成团的。 |
|