码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
【leetcode】Path Sum2
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:其他好文   时间:2015-04-02 15:01:01    阅读次数:112
【leetcode】Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:其他好文   时间:2015-04-02 14:48:37    阅读次数:163
leetCode 98-Validate Binary Search Tree
题目链接:https://leetcode.com/problems/validate-binary-search-tree/ 就是判断一个给定的二叉树是否为二叉查找树。 我的思路是:先将该树中序遍历一遍,按中序遍历的顺序保存到一个vector中,然后判断vector中的顺序即可。 代码: class Solution { public: void inOrder(TreeNode...
分类:其他好文   时间:2015-04-02 10:29:28    阅读次数:107
leetcode_num98_Validate Binary Search Tree
判断是否为二叉搜索树 定义上下确界 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} *...
分类:其他好文   时间:2015-04-01 23:51:43    阅读次数:130
Leetcode: Binary Tree Preorder Traversal(二叉树非递归前序遍历)
题目: Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3},1    \     2    / 3return [1,2,3].Note: Recursive solution is triv...
分类:其他好文   时间:2015-04-01 21:56:42    阅读次数:96
Binary Tree Preorder Traversal
二叉树的前序遍历 思路:小心程序运行栈溢出,用stack模拟 class Solution {public: vector preorderTraversal(TreeNode *root) { stack stk; vector res; if (root) stk.push(root); els...
分类:其他好文   时间:2015-04-01 11:10:06    阅读次数:134
关于erlang的binary
引自:http://cryolite.iteye.com/blog/15472521. binary数据是可以在不同进程间共享的 当然这些进程都在同一Erlang节点上。这与普通term不同,后者作为消息在进程间传递时是要在接收进程中做拷贝的(当然atom数据例外,它们也不会做拷贝)。摘一段原文在这...
分类:其他好文   时间:2015-04-01 10:52:40    阅读次数:126
HDOJ 题目1710 Binary Tree Traversals(二叉搜索树)
Binary Tree Traversals Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3912    Accepted Submission(s): 1741 Problem Description A b...
分类:其他好文   时间:2015-04-01 09:41:27    阅读次数:209
【leetcode刷题笔记】Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题解:递归就可以了。Java代码如下: 1 /** 2 * Definition for binary ....
分类:其他好文   时间:2015-04-01 00:16:07    阅读次数:96
LeetCode Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 题意:二进制的加法。 思路:跟大数加法差不多。 class Solution { public: string addBinary(string a, ...
分类:其他好文   时间:2015-03-31 22:25:38    阅读次数:160
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!