【106-Construct Binary Tree from Inorder and Postorder Traversal(通过中序和后序遍历构造二叉树II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given inorder and postorder traversal of a tree, construct the binary tree.
No...
分类:
编程语言 时间:
2015-08-09 07:14:18
阅读次数:
192
【106-Construct Binary Tree from Preorder and Inorder Traversal(通过前序和中序遍历构造二叉树)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given preorder and inorder traversal of a tree, construct the binary tree.
Note:...
分类:
编程语言 时间:
2015-08-09 07:13:59
阅读次数:
234
【104-Maximum Depth of Binary Tree(二叉树的最大深度)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from th...
分类:
编程语言 时间:
2015-08-08 07:59:24
阅读次数:
126
【103-Binary Tree Zigzag Level Order Traversal(二叉树分层Z字形遍历)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to righ...
分类:
编程语言 时间:
2015-08-08 07:58:56
阅读次数:
182
【102-Binary Tree Level Order Traversal(二叉树层序遍历)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level...
分类:
编程语言 时间:
2015-08-08 07:58:06
阅读次数:
259
【101-Symmetric Tree(对称树)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetr...
分类:
编程语言 时间:
2015-08-07 08:19:16
阅读次数:
163
【096-Unique Binary Search Trees(唯一二叉搜索树)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?
For example,
Given n = 3, t...
分类:
编程语言 时间:
2015-08-07 08:18:59
阅读次数:
172
【100-Same Tree(两棵树是否相同)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structural...
分类:
编程语言 时间:
2015-08-07 08:18:10
阅读次数:
185
【094-Binary Tree Inorder Traversal(二叉树中序遍历)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, return the inorder traversal of its nodes’ values.
题目大意 对一棵二叉树进行中序遍历。
解题思路 解法一:递归实现,解法二:迭代实现。...
分类:
编程语言 时间:
2015-08-06 08:18:21
阅读次数:
305
【092-Reverse Linked List II(反转单链表II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m =...
分类:
编程语言 时间:
2015-08-06 08:16:04
阅读次数:
195