Careercup - Google面试题 - 5085331422445568
2014-05-08 23:45
原题:
How would you use Dijkstra's algorithm to solve travel salesman problem, which is to find a shortest path from a starting node back to the starting node and visits all other node exactly once.
题目:如何用Dijkstra算法来解决TSP问题?(谁会出这种题,这又是“Guy”从哪儿copy来的?)
解法:对于这种问题我不知道该说什么。一个多项式级别的算法来解决NP问题,这已经超出了面试题或者教科书的范畴吧?这个“Guy”自己写的代码都够呛,还能问别人这种问题,实在让人无力吐槽。Dijkstra算法用于解决单源最短路径问题,而且要求没有负权的边。就算是用其他算法来近似最优解,也应该用类似最小生成树的算法吧。所以我觉得这个“Guy”应该被永久禁止发帖,完全是在误导我们这些辛辛苦苦做面试题的人。找个工作容易吗?
代码:
// http://www.careercup.com/question?id=5085331422445568
// Answer:
// Dijkstra Algorithm is not for TSP, why would you expect to solve NP-hard problems with O(n ^ 2) efforts?
// Comment:
// 1. Difficult question.
// 2. Vague description.
// 3. Strange indication.
// 4. Stupid discussion.
// Based on the judgement above, I believe that 'guy' is a complete amateur. Excellent programmers don't ask stupid questions, but he did.
// The reason I'm complaining is that, he pretended to have google interview experience and posted a lot of fake questions only to trick us.
// He doesn't even know how to calculate the distance between two points?
// He doesn't know what volatile means.
// He keeps asking stupid questions.
// SO HOW THE HELL DOES THIS 'GUY' HAVE SO MANY GOOGLE INTERVIEWS?
// He's site reliability engineer at Boeing, really?
// I hate liars, especially foolish liars!
// Down vote for every question he posted.
int main()
{
return ;
}
Careercup - Google面试题 - 5085331422445568的更多相关文章
- Careercup - Google面试题 - 5732809947742208
2014-05-03 22:10 题目链接 原题: Given a dictionary, and a list of letters ( or consider as a string), find ...
- Careercup - Google面试题 - 4847954317803520
2014-05-08 21:33 题目链接 原题: largest number that an int variable can fit given a memory of certain size ...
- Careercup - Google面试题 - 6332750214725632
2014-05-06 10:18 题目链接 原题: Given a ,) (,) (,), (,) should be returned. Some suggest to use Interval T ...
- Careercup - Google面试题 - 5634470967246848
2014-05-06 07:11 题目链接 原题: Find a shortest path ,) to (N,N), assume is destination, use memorization ...
- Careercup - Google面试题 - 5680330589601792
2014-05-08 23:18 题目链接 原题: If you have data coming in rapid succession what is the best way of dealin ...
- Careercup - Google面试题 - 5424071030341632
2014-05-08 22:55 题目链接 原题: Given a list of strings. Produce a list of the longest common suffixes. If ...
- Careercup - Google面试题 - 5377673471721472
2014-05-08 22:42 题目链接 原题: How would you split a search query across multiple machines? 题目:如何把一个搜索que ...
- Careercup - Google面试题 - 6331648220069888
2014-05-08 22:27 题目链接 原题: What's the tracking algorithm of nearest location to some friends that are ...
- Careercup - Google面试题 - 5692127791022080
2014-05-08 22:09 题目链接 原题: Implement a class to create timer object in OOP 题目:用OOP思想设计一个计时器类. 解法:我根据自 ...
随机推荐
- WP8.1 添加启动画面
1.新建WP8.1工程,将需要设置为启动画面的图片添加到工程中,并且重命名为splash-Phone-sdk.png(必须命名为该名字). 2.在工程中有Package.appxmanifest,双击 ...
- Mysql 自定义随机字符串
前几天在开发一个系统,需要用到随机字符串,但是mysql的库函数有没有直接提供,就简单的利用现有的函数东拼西凑出随机字符串来.下面简单的说下实现当时. 1.简单粗暴. select ..., subs ...
- 比较合并工具vimdiff的主要用法归纳
参考:https://www.ibm.com/developerworks/cn/linux/l-vimdiff/ vimdiff主要用法归纳如下: 1.打开文件 vimdiff file1 fi ...
- jquery二级目录选中当前页的样式
<div class="navlist clear"> <span><a href="/M/Page_32.html" title ...
- [leetcode]_Integer to Roman
题目:对应之前那道将罗马数字转换整型数字的题目.反过来. 思路:刚开始做的时候,想着用程序进行判断,复杂的要死.网络了别人代码,非常清晰. 代码: 1 public String intToRoman ...
- JS模块化工具requirejs教程(一):初识requirejs
随着网站功能逐渐丰富,网页中的js也变得越来越复杂和臃肿,原有通过script标签来导入一个个的js文件这种方式已经不能满足现在互联网开发模式,我们需要团队协作.模块复用.单元测试等等一系列复杂的需求 ...
- 用过的一些js函数[备份用的]
1.类似php的htmlspecialchars函数,如需要可以自行增加其它代替 function _htmlspecialchars(str) { str = str.replace(/&/ ...
- 添加常驻Notification
private static final int NOTIFICATION_ID=250; //用来标示notification,通过notificatinomanager来发布同样标示的notifi ...
- asp.net 发布后用IP访问正常,用机器名访问布局出错
问题如题[发布后IP访问正常,用机器名访问布局出现问题] 出现此问题的原因:IE文档模型发生变化,比如ip访问时IE文档模型为:IE10,换用机器名访问时,文档模型变为IE7 解决方法:设置默认IE版 ...
- 多线程基本概论multithread
多线程 基本概念 进程 进程是指在系统中正在运行的一个应用程序 每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内 通过 活动监视器 可以查看 Mac 系统中所开启的进程 线程 进程要想 ...