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
Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p...
分类:
其他好文 时间:
2014-07-27 10:05:32
阅读次数:
352
var form = new Ext.form.FormPanel({ labelAlign : 'right', border : false, bodyStyle : 'background-color: transpar...
分类:
Web程序 时间:
2014-07-27 09:48:22
阅读次数:
291
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
原理就是先利用两个数间的差分,因为把一段连续的数做标记相当于头差分+1,尾差分-1,然后做前缀和即可。可以想到,相比segment tree这种个只适合于查询操作不多但修改操作很多的情况(如果保存前缀和修改又会降速),否则计算前缀和会很费时。/*ID:esxgx1LANG:C++PROG:hdu15...
分类:
其他好文 时间:
2014-07-26 17:05:31
阅读次数:
233
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
class Solution {
public:
const int MAXVALUE = 1 << 30;
int findMinStepToIndex(int maxNumbers[],int maxSteps,int index)
{
if (index == 0)
return 0;
int left = 1;
int right = maxSteps;...
分类:
其他好文 时间:
2014-07-26 15:30:01
阅读次数:
170
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
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
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