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. activiti搭建(四)八项服务介绍

    转载请注明源地址:http://www.cnblogs.com/lighten/p/5927949.html 1.前言 之前学习的时候一直在其它文章看到activiti提供了七个接口来操作工作流,但在 ...

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

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

  3. 在网页中使用H1标记的须注意的事项

    H1标签是网站排名非常重要的一个因素,因此我们一定要正确使用它. 本文为你介绍H1标签使用的七大注意事项: 1.每个页面都应该有H1标签,H1标签是每个网页不可缺少的要素. 2.使用H1标签的内容应该 ...

  4. bea weblogic workshop中文乱码

    重装系统后,weblogic 8.1 workshop中的中文字体是乱码. 可通过菜单中的 Tools -> IDE Properties -> Display, 在Window font ...

  5. 例题6-10 The Falling Leaves,UVA699

    这道题我的思路是先通过递归构建树,然后进行遍历将位置和保存在map映射中,最后按顺序输出map集合中的值. 至于如何遍历,我是依次尝试了宽度优先遍历和深度优先遍历,当然这都是可以的.不过期间写错了很多 ...

  6. 学习c的第7天

    #include <stdio.h> int main() { int x=0; if (x==0) { printf("x为假\n"); } else { print ...

  7. linux资源监控命令详解

    Linux统计/监控工具SAR详细介绍:要判断一个系统瓶颈问题,有时需要几个 sar 命令选项结合起来使用,例如: 怀疑CPU存在瓶颈,可用 sar -u 和 sar -q deng 等来查看 怀疑内 ...

  8. python学习第二天第一部分

    备注:写程序不能写重复性的代码 学习内容:数据类型.for循环.while循环.字符编码.文件处理 一.for循环 1.简单的for循环 for i in range(10): # 此处意思为:循环r ...

  9. 简答的理解C语言中的各种类型函数

    1.变参函数 变长参数的函数即参数个数可变.参数类型不定 的函数.最常见的例子是printf函数.scanf函数和高级语言的Format函数.在C/C++中,为了通知编译器函数的参数个数和类型可变(即 ...

  10. [转]C++编写Config类读取配置文件

    //Config.h #pragma once #include <string> #include <map> #include <iostream> #incl ...