Careercup - Google面试题 - 5085331422445568
2024-10-14 17:40:12
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 ;
}
最新文章
- HTML5 简易转盘
- Hibernate中的GetCurrentSession()方法
- zedboard启动过程分析
- 51nod贪心算法入门-----完美字符串
- 解决Jquery和prototype的兼容问题
- BZOJ3053: The Closest M Points
- Routing
- hdu 4198 Quick out of the Harbour(BFS+优先队列)
- LR的VG与Control之间的关系,并发的实质
- Power BI Embedded 与 Bot Framework 结合的AI解决方案
- citrix外企,鸡鸣寺,玄武湖环跑,七牛云笔试
- SqlServer如何获取存储过程的返回值
- dom 及bom
- JTA事务管理
- SSM框架的sql中参数注入(#和$的区别)
- eclipse搭建j2ee
- ReactPHP── PHP版的Node.js(转)
- UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 263: i llegal multibyte sequence
- DevExpress.XtraEditors.Groupcontrol 中创建按钮
- Hibernate核心对象
热门文章
- IIS报错 未将对象引用设置到对象的实例。
- Java设计模式(Design Patterns In Java)读书摘要——第1章 绪论
- 快速解决Canvas.toDataURL 图片跨域的问题
- 百度 迷你版 UMeditor富文本编辑器 使用方法
- How to move the user document folder to D disk[Windows 7]
- linux动态库编译和使用详细剖析
- 对 cloudwu 简单的 cstring 进行简单解析
- Ajax-goahead局部刷新页面
- 使用MSYS2编译64位gvim
- 通过java反射实现简单的关于MongoDB的对象关系映射(ORM).