题意:给你一棵树,问你树中距离为k的有多少种情况。解题思路:树形dp 维护每个节点(1-K)深度的情况,解题代码: 1 // File Name: 161d.cpp 2 // Author: darkdream 3 // Created Time: 2014年08月03日 星期日 19时20分10秒...
分类:
其他好文 时间:
2014-08-03 20:36:35
阅读次数:
201
package com.iflytek.tree;
import java.util.Random;
/**
* 二叉查找树
* @author fgtian
*
*/
public class BinaryTree {
public static class BinaryTreeNode {
int mValue; // 数值:以int代替,可以扩展成其他的
Binary...
分类:
其他好文 时间:
2014-08-03 18:09:35
阅读次数:
211
在stl中容器分为两大类,序列式容器和关联式容器。序列式容器:array、vector、heap、priority-queue、list、slist、deque、(stack、queue)最后两个是配接器关联式容器:RB-tree、set、map、multiset、multimap、hashtabl...
分类:
其他好文 时间:
2014-08-03 17:50:15
阅读次数:
232
JsRender DemosExample Scenario: Accessing parent data.Stepping up through the views (tree of nested rendered templates) TitleLang...
分类:
Web程序 时间:
2014-08-03 15:10:25
阅读次数:
294
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 and the nodes have the same value.
/**
...
分类:
其他好文 时间:
2014-08-03 12:54:55
阅读次数:
201
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe...
分类:
其他好文 时间:
2014-08-03 12:49:15
阅读次数:
229
二叉堆(binary heap) 二叉堆数据结构是一种数组对象,它可以被视为一棵完全二叉树。同二叉查找树一样,堆也有两个性质,即结构性和堆序性。对于数组中任意位置i上的元素,其左儿子在位置2i上,右儿子在左儿子后的单元2i+1中,它的父亲在[i/2](向下取整)中。因此,一个数据结构将由一个数组、....
分类:
其他好文 时间:
2014-08-03 12:30:25
阅读次数:
324
HDU 1325 Is It A Tree?
并査集...
分类:
其他好文 时间:
2014-08-03 10:21:25
阅读次数:
220
问题:将二叉树的所有结点指向他的右边的一个结点分析:对于每一个结点来说,其操作都是一样的,除了他的左儿子指向右儿子外,其左儿子的全部右后辈均指向其右儿子的全部左后辈/** * Definition for binary tree with next pointer. * struct TreeLin...
分类:
其他好文 时间:
2014-08-03 10:12:05
阅读次数:
178