• 请不要在回答技术问题时复制粘贴 AI 生成的内容
banxi1988
V2EX  ›  程序员

决定学习怎么写翻转二叉树了.

  •  
  •   banxi1988 ·
    banxi1988 · Jun 11, 2015 · 7446 views
    This topic created in 4172 days ago, the information mentioned may be changed or developed.
    https://twitter.com/mxcl/status/608682016205344768

    from @mxcl
    > Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.
    21 replies  •  2015-06-11 15:56:48 +08:00
    ycge234
    ycge234
    Jun 11, 2015
    1
    然并卵,并不能进Google···
    knightdf
    knightdf
    Jun 11, 2015
    2
    然并卵
    JackBlack2006
    JackBlack2006
    Jun 11, 2015
    3
    你就算学会写,不出镇子也没用,我大学刚毕业那会儿给谷歌发简历,人家要面试,结果我说自己在镇子,人家就没回复了,连 Skype 远程面试机会都没有
    linzhi
    linzhi
    Jun 11, 2015
    4
    然并卵
    gaoxt1983
    gaoxt1983
    Jun 11, 2015
    5
    我还以为翻转二叉树是啥呢,原来就是左右换一下,写个递归不就行了……
    pyKun
    pyKun
    Jun 11, 2015
    6
    @JackBlack2006 啥是镇子?
    yanyandenuonuo
    yanyandenuonuo
    Jun 11, 2015
    7
    @JackBlack2006 高端黑么。。。
    bellchu
    bellchu
    Jun 11, 2015 via iPhone
    8
    @gaoxt1983 不可以用递归
    jadecoder
    jadecoder
    Jun 11, 2015
    9
    @pyKun 景德镇
    sheep42
    sheep42
    Jun 11, 2015
    10
    @JackBlack2006 每隔一段时间会有那边的工程师来面试的啊
    Andiry
    Andiry
    Jun 11, 2015
    11
    我会写递归及非递归的二叉树翻转,然并卵
    Andiry
    Andiry
    Jun 11, 2015
    12
    不过说句实话,遍历也就罢了,翻转二叉树这种东西有什么实际用途吗?考这到底有什么用,实在想不出来
    wdlth
    wdlth
    Jun 11, 2015
    13
    下次Google又会出,你可以做出一个翻转的Google页面么……
    ffffwh
    ffffwh
    Jun 11, 2015
    14
    Google Sucks -- YinWang
    jjx
    jjx
    Jun 11, 2015
    15
    什么是二叉树?:)
    lxrmido
    lxrmido
    Jun 11, 2015
    16
    @wdlth
    transform:rotateX(180deg);
    suliuyes
    suliuyes
    Jun 11, 2015
    17
    on a whiteboard
    是要手写吧,大牛手写算法也不一定牛。平时用的少,还得先准备
    KingHL
    KingHL
    Jun 11, 2015
    18
    刷题很好,然而并没有事很么卵用
    TimLang
    TimLang
    Jun 11, 2015
    19
    以前数据结构考试比较难的就是二叉树的前序、中序、后序,而且全是在纸上自己算出来写卷子上的。话说工作到现在碰到过这个应用场景。
    Magic347
    Magic347
    Jun 11, 2015
    20
    非递归不难实现,用一个栈就可解。
    初始化时,将根节点入栈。
    每次弹出栈顶元素(如果有),swap该元素的左右孩子节点(如果有孩子节点,注意左右孩子节点是否均存在),
    然后依次把swap之后的左右孩子节点(如果存在)重新压回栈内。
    重复上述操作,直到栈空,done。
    递归实现的话,就更符合人类思维的自然逻辑了,此处skip。
    wdlth
    wdlth
    Jun 11, 2015
    21
    @lxrmido 不能使用CSS3,还得兼容各种浏览器,比如毒瘤IE6。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1293 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 17:19 · PVG 01:19 · LAX 09:19 · JFK 12:19
    ♥ Do have faith in what you're doing.