• Careercup


    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”应该被永久禁止发帖,完全是在误导我们这些辛辛苦苦做面试题的人。找个工作容易吗?

    代码:

     1 // http://www.careercup.com/question?id=5085331422445568
     2 // Answer:
     3 //    Dijkstra Algorithm is not for TSP, why would you expect to solve NP-hard problems with O(n ^ 2) efforts?
     4 // Comment:
     5 //    1. Difficult question.
     6 //    2. Vague description.
     7 //    3. Strange indication.
     8 //    4. Stupid discussion.
     9 // Based on the judgement above, I believe that 'guy' is a complete amateur. Excellent programmers don't ask stupid questions, but he did.
    10 // 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.
    11 // He doesn't even know how to calculate the distance between two points?
    12 // He doesn't know what volatile means.
    13 // He keeps asking stupid questions.
    14 // SO HOW THE HELL DOES THIS 'GUY' HAVE SO MANY GOOGLE INTERVIEWS?
    15 // He's site reliability engineer at Boeing, really?
    16 // I hate liars, especially foolish liars!
    17 // Down vote for every question he posted.
    18 int main()
    19 {
    20     return 0;
    21 }
  • 相关阅读:
    npm 插件发布和使用
    git 配置与删除远程地址
    elment 编辑输出行数据后,过滤下拉,值必须全等于下拉值
    后台 接口 传值 不同类型的详细解说
    Vue vscode调试
    vue 标题和输入框分两行,调成一行
    ES6 学习笔记(持续更新中)
    vue开发WebApp 开发笔记(持续更新)
    移动端自适应方案 对应设计图制作
    css 颜色使用预览 码表
  • 原文地址:https://www.cnblogs.com/zhuli19901106/p/3717959.html
Copyright © 2020-2023  润新知