摘要: Description:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each... 阅读全文
posted @ 2015-09-29 22:22 Pickle 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 常见的前序、中序、后序都很常见,最近用到了按层遍历,记录一下:思路:用一个队列来作为辅助空间。依次存储头结点,左节点和右节点。每次循环输出节点的值,直到队列为空这样一来就利用了队列先进先出的性质实现了非递归按层遍历二叉树。具体实现:void levelOrderTraverse(const BiTr... 阅读全文
posted @ 2015-09-29 21:32 Pickle 阅读(638) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexcept... 阅读全文
posted @ 2015-09-29 17:49 Pickle 阅读(141) 评论(0) 推荐(0) 编辑