码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
LeetCode - Refresh - Path Sum
Recursive. 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * ...
分类:其他好文   时间:2015-03-21 18:32:35    阅读次数:129
LeetCode - Refresh - Path Sum II
Same with I 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * ...
分类:其他好文   时间:2015-03-21 18:25:44    阅读次数:148
LeetCoode—**Convert Sorted List to Binary Search Tree 将单链表表示为平衡二叉
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 我想如果只是表示成二叉树,没有什么难度,但是如果是表示为平衡二叉树那么可能就有难度了 要求左右子树的高度是均衡的 先给出自己的解法,很low,就是现将节点都保存在vector...
分类:其他好文   时间:2015-03-21 17:10:11    阅读次数:158
表达式二叉树
涞源chengyaogen.blog.chinaunix.net一、定义 二叉树(binary tree)是一棵每个结点都不能有多于两个儿子的树。二、数据结构设计 因为一个二叉树结点最多是有两个儿子,所以可以直接链接到他们。树结点的声明在结构上类似双向链表的声明。在声明中,一个结点就是由el...
分类:其他好文   时间:2015-03-21 16:51:14    阅读次数:127
【LeetCode】Recover Binary Search Tree 解题报告
【题目】 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Could...
分类:其他好文   时间:2015-03-21 12:42:54    阅读次数:129
Unique Binary Search Trees
问题来源:https://leetcode.com/problems/unique-binary-search-trees//** * * * ClassName UniqueBinarySearchTrees * * * Description Given n, how many structurally unique BST's (binary searc...
分类:其他好文   时间:2015-03-21 12:40:04    阅读次数:135
【LeetCode】190. Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:其他好文   时间:2015-03-21 12:35:31    阅读次数:143
LeetCode OJ Convert Sorted Array to Binary Search
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. class Solution { public: vector Num; TreeNode *sortedArrayToBST(vector &num) { if (num.size() == 0) r...
分类:其他好文   时间:2015-03-21 11:24:00    阅读次数:169
LeetCode – Refresh – Minimum Depth of Binary Tree
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i...
分类:其他好文   时间:2015-03-21 08:35:28    阅读次数:123
LeetCode – Refresh – Maximum Depth of Binary Tree
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i...
分类:其他好文   时间:2015-03-21 06:22:17    阅读次数:111
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!