码迷,mamicode.com
首页 >  
搜索关键字:binary tree    ( 23211个结果
HNU 12834 Thread Tree
递归输出就行了 #include using namespace std; struct tree{ int dot; string s; }t[1020]; int si[1020],a[1020][1020]; void print(int x) { for(int i=0;i<=si[x]-1;i++) { for(int j=1;j<=t[...
分类:其他好文   时间:2014-07-27 11:48:53    阅读次数:188
spoj cot: Count on a tree 主席树
10628. Count on a treeProblem code: COTYou are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight.We wi...
分类:其他好文   时间:2014-07-27 10:31:42    阅读次数:304
POJ - 1679 The Unique MST (次小生成树)
Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of...
分类:其他好文   时间:2014-07-26 17:19:22    阅读次数:401
HDU 1556 - Color the ball
原理就是先利用两个数间的差分,因为把一段连续的数做标记相当于头差分+1,尾差分-1,然后做前缀和即可。可以想到,相比segment tree这种个只适合于查询操作不多但修改操作很多的情况(如果保存前缀和修改又会降速),否则计算前缀和会很费时。/*ID:esxgx1LANG:C++PROG:hdu15...
分类:其他好文   时间:2014-07-26 17:05:31    阅读次数:233
LeetCode "Populating Next Right Pointers in Each Node II"
Compared with I version, the tree could be incomplete. The only difference is that, we connect current node's child to next non-childrenless' node's f...
分类:其他好文   时间:2014-07-26 17:02:11    阅读次数:316
POJ - 3013 Big Christmas Tree
Description Christmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture. The tree can ...
分类:其他好文   时间:2014-07-26 15:01:50    阅读次数:300
[LeetCode] Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example: Given binary tree {3...
分类:其他好文   时间:2014-07-26 14:03:16    阅读次数:174
SPOJ QTREE系列 树上分治问题。
375.Query on a tree 【QTREE】 有两个操作: (1)修改第i条边的边权 (2)询问a到b路径上的边权最大值。 树链剖分入门题。树链剖分+线段树维护最大值。修改/查询均为O(log^2)。 很懒,没有写。913.Query on a tree II 【QTREE2...
分类:其他好文   时间:2014-07-26 13:53:45    阅读次数:569
Maximal Rectangle leetcode java
题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题解:这道题可以应用之前解过的Largetst Recta....
分类:编程语言   时间:2014-07-26 09:55:57    阅读次数:301
Phoenix Framework中为Tree的每个节点设置不同图标的方法
在封装Javax Swing的Tree对象时,需要为其每个节点设置不同的图标。故封装了一个公共方法: {CSDN:CODE:435261} 使用方法: jTree1.setCellRenderer(new TreeNodeRender(casesIcon)); 需要注意的是caseIcon为一个List对象. 示例如图,传入了3个ImageIcon对象,按...
分类:其他好文   时间:2014-07-26 02:24:26    阅读次数:324
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!