2015年7月14日

摘要: 题目:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the n... 阅读全文
posted @ 2015-07-14 19:25 承续缘 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa... 阅读全文
posted @ 2015-07-14 18:39 承续缘 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题目:Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, exc... 阅读全文
posted @ 2015-07-14 17:25 承续缘 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's t... 阅读全文
posted @ 2015-07-14 13:00 承续缘 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目:Invert Binary TreeTotal Accepted:20346Total Submissions:57084My SubmissionsQuestionSolutionInvert a binary tree. 4 / \ 2 7 / \ / \1 ... 阅读全文
posted @ 2015-07-14 12:48 承续缘 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedi... 阅读全文
posted @ 2015-07-14 12:35 承续缘 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowe... 阅读全文
posted @ 2015-07-14 10:55 承续缘 阅读(249) 评论(0) 推荐(0) 编辑

导航