2014-05-08 22:42

题目链接

原题:

How would you split a search query across multiple machines?

题目:如何把一个搜索query分发到多个机器上?

解法:又是“Guy”出的题目。对query字符串算取数字签名,然后对集群的机器数量取模,就可以得到对应落在的机器了。

代码:

 // http://www.careercup.com/question?id=5377673471721472
// Answer:
// The genenral practice of splitting queries across multiple machine, would require two parts:
// 1. convert the query to a digital sign, possibly an integer.
// 2. modulo it by the number of machines in a cluster, this process may be multi-layered.
// Other scheduling strategies may affect the result of splitting, but I think modulo will be a simple and balanced way to split the queries.
int main()
{
return ;
}

Careercup - Google面试题 - 5377673471721472的更多相关文章

  1. Careercup - Google面试题 - 5732809947742208

    2014-05-03 22:10 题目链接 原题: Given a dictionary, and a list of letters ( or consider as a string), find ...

  2. Careercup - Google面试题 - 5085331422445568

    2014-05-08 23:45 题目链接 原题: How would you use Dijkstra's algorithm to solve travel salesman problem, w ...

  3. Careercup - Google面试题 - 4847954317803520

    2014-05-08 21:33 题目链接 原题: largest number that an int variable can fit given a memory of certain size ...

  4. Careercup - Google面试题 - 6332750214725632

    2014-05-06 10:18 题目链接 原题: Given a ,) (,) (,), (,) should be returned. Some suggest to use Interval T ...

  5. Careercup - Google面试题 - 5634470967246848

    2014-05-06 07:11 题目链接 原题: Find a shortest path ,) to (N,N), assume is destination, use memorization ...

  6. Careercup - Google面试题 - 5680330589601792

    2014-05-08 23:18 题目链接 原题: If you have data coming in rapid succession what is the best way of dealin ...

  7. Careercup - Google面试题 - 5424071030341632

    2014-05-08 22:55 题目链接 原题: Given a list of strings. Produce a list of the longest common suffixes. If ...

  8. Careercup - Google面试题 - 6331648220069888

    2014-05-08 22:27 题目链接 原题: What's the tracking algorithm of nearest location to some friends that are ...

  9. Careercup - Google面试题 - 5692127791022080

    2014-05-08 22:09 题目链接 原题: Implement a class to create timer object in OOP 题目:用OOP思想设计一个计时器类. 解法:我根据自 ...

随机推荐

  1. 必须会的SQL语句(五)NULL数据处理和类型转换

    1.Null数据的处理     1)检索出null值               select * from 表 where xx is null        2)null值替换      sele ...

  2. 从手机获取图片让WebView支持本地上传图片

    一,从本地获取相册中的图片,并获取图片的URI 从本地选择图片上传到服务器时,首先要打开本地图片或文件管理器选择要上传的文件,代码如下 Intent intent =newIntent(Intent. ...

  3. 树莓派(Rospberry Pi B+)到货亲测

    1 图鉴 Rospberry Pi  B+终于在今天下午有蜗牛快递公司圆*送到了.B+主要是增加了2个USB,增加了GPIO,sd卡换成了micro sd ...先不说直接上图再说,期待了好久好久 整 ...

  4. VS2008使用技巧及快捷键大全

    VS2008技巧,非常实用,非常提高效率. 1,Visual Studio 2008自带的1000多个 Windows 系统使用的各种图标.光标和动画文件在Visual Studio 2008的安装目 ...

  5. kettle的job

    1.首先创建一个job 2.拖拽组件形成下面的图 这里需要注意,在作业中的连线分为三类: 黄色锁的线:这个步骤执行之后,无论失败与否都会执行下一个步骤 绿色对号线:步骤执行成功了,才会执行下一个步骤. ...

  6. ThinkPHP之中的验证码的小示例

    ThinkPHP之中已经封装好了验证码的调用,但是关于手册,缺失了HTML之中以及.实际操作之中的点击ajax就会刷新验证码ajax代码:现在分享一下:看客老爷们注意啦! 放大招啦!!!三分归元气-- ...

  7. PHP常用函数和常见疑难问题解答

    PHP常用库函数介绍 一.PHP字符串操作常用函数 1.确定字符串长度  int strlen(string str) 2.比较两个字符串 a. strcmp函数对两个字符串进行二进制安全的比较,并区 ...

  8. sql,插入最大值加1

    insert into aa (id,name) values((select case when max(id) is null then 1 else max(id)+1 end from aa) ...

  9. Head First-策略模式

    策略模式,什么是策略模式,定义了算法族,分别封装起来,让他们之间可以相互替换,此模式让算法的变化独立于使用算法的客户. 下面我们就用鸭子来诠释一下策略模式,鸭子有两种行为呱呱叫和飞,但是并不是所有的鸭 ...

  10. Java transient volatile关键字(转)

    Volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值.而且,当成员变量发生变化时,强迫线程将变化值回写到主内存.这样在任何时刻,两个不同的线程总是看到某个成员变量的同一 ...