从数字流中返回直方图 [英] Return a histogram from a stream of numbers

查看:47
本文介绍了从数字流中返回直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被问到这个问题来测试我对可扩展性的了解。有一个数字流,我必须返回代表这些数字的直方图。我问了一些问题,比如数字的范围和直方图等的桶尺寸,他回答说我可以选择铲斗尺寸,我不需要重新调整铲斗等等。所以我的解决方案当我收到一个号码时,我会更新一个特定桶的计数器。最后,我将返回0-100,101-200之类的桶以及每个桶的相应计数。我没有通过面试,我想知道什么是这样的问题的合适答案

I was asked this question to test my knowledge of scalability. There are a stream of numbers and I have to return a histogram representing these numbers. I asked questions like what would be the range of the numbers and what would be the bucket size of the histograms etc. to which he responded that I could select the bucket size and I don't have to rescale the buckets etc. So my solution was that as I receive a number I will update a counter for a particular bucket. In the end I will return back the buckets like 0-100,101-200 and the corresponding count of each bucket. I didn't get through the interview and I was wondering as to what would be a suitable answer to a question like this

推荐答案

正如你已经被告知的那样除了面试官所期待的那个之外,没有合适的答案。如果你想通过面试,唯一的方法就是要对你所干预的主题角色有一个很好的理解和经验。
As you have already been told, there is no suitable answer apart from the one the interviewer was expecting. If you want to pass an interview, the only way is to have a good understanding of, and experience in, the subject role that you are interviwiewing for.


这篇关于从数字流中返回直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆