码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
UVa 10214 (莫比乌斯反演 or 欧拉函数) Trees in a Wood.
题意:这道题和POJ 3090很相似,求|x|≤a,|y|≤b 中站在原点可见的整点的个数K,所有的整点个数为N(除去原点),求K/N分析:坐标轴上有四个可见的点,因为每个象限可见的点数都是一样的,所以我们只要求出第一象限可见的点数然后×4+4,即是K。可见的点满足gcd(x, y) = 1,于是将...
分类:其他好文   时间:2015-01-03 11:55:19    阅读次数:167
【leetcode】Binary Tree Maximum Path Sum
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be...
分类:其他好文   时间:2015-01-03 11:52:22    阅读次数:137
【leetcode】Path Sum II
Path Sum IIGiven 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 tr...
分类:其他好文   时间:2015-01-03 11:50:53    阅读次数:110
Binary Search Tree Iterator
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 next...
分类:其他好文   时间:2015-01-03 11:50:18    阅读次数:135
Majority Element(ARRAY-BINARY SEARCH)
QUESTIONGiven an array of size n, find the majority element. The majority element is the element that appears more than ? n/2 ? times.You may assume t...
分类:其他好文   时间:2015-01-03 11:48:00    阅读次数:146
Twitter OA prepare: Flipping a bit
You are given a binary array with N elements: d[0], d[1], ... d[N - 1]. You can perform AT MOST one move on the array: choose any two integers [L, R],...
分类:其他好文   时间:2015-01-03 07:05:32    阅读次数:298
LeetCode: Construct Binary Tree from Preorder and Inorder Traversal 解题报告
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:其他好文   时间:2015-01-03 00:53:53    阅读次数:235
数据结构——二叉树(Binary Trees)
非线性数据结构树的密度=结点数/高度二叉树类 1 #pragma once 2 3 class stnode 4 { 5 public: 6 int nodeValue; // node data 7 8 stnode *left, *right, *...
分类:其他好文   时间:2015-01-02 22:18:52    阅读次数:392
Leetcode:Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:其他好文   时间:2015-01-02 22:15:05    阅读次数:307
Leetcode:Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:其他好文   时间:2015-01-02 21:08:27    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!