码迷,mamicode.com
首页 >  
搜索关键字:spoj balnum balanced    ( 1777个结果
HDU 3709 Balanced Number
HDU 3709 Balanced Number (数位DP)...
分类:其他好文   时间:2014-08-18 14:34:22    阅读次数:200
poj 3264(模板RMQ)
Balanced Lineup Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 34488   Accepted: 16203 Case Time Limit: 2000MS Description For the daily milking, Farme...
分类:其他好文   时间:2014-08-18 10:51:03    阅读次数:259
数据结构快速回顾——平衡二叉树 AVL (转)
平衡二叉树(Balanced Binary Tree)是二叉查找树的一个进化体,也是第一个引入平衡概念的二叉树。1962年,G.M. Adelson-Velsky 和 E.M. Landis发明了这棵树,所以它又叫AVL树。平衡二叉树要求对于每一个节点来说,它的左右子树的高度之差不能超过1,如果.....
分类:其他好文   时间:2014-08-18 10:26:43    阅读次数:187
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:取数组的中点为树的根,前半部分为左子树,后半部分为右子树。 1 class Solution { 2...
分类:其他好文   时间:2014-08-17 13:02:12    阅读次数:210
Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.思路:使用两个指针分别以1、2的速度遍历链表,以定位出链表的中点,进而将链表分割成...
分类:其他好文   时间:2014-08-17 02:21:36    阅读次数:246
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:其他好文   时间:2014-08-16 23:42:41    阅读次数:165
[POJ] 3264 Balanced Lineup [线段树]
Balanced LineupTime Limit:5000MSMemory Limit:65536KTotal Submissions:34306Accepted:16137Case Time Limit:2000MSDescriptionFor the daily milking, Farmer...
分类:其他好文   时间:2014-08-16 17:01:10    阅读次数:237
[leetcode]Convert Sorted List to Binary Search Tree
Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:其他好文   时间:2014-08-16 12:19:20    阅读次数:227
spoj1811 Longest Common Substring,后缀自动机
spoj1811LCS 问两个字符串最长公共子串。 做法很简单。匹配成功,则tl++,失败,从父指针回退,tl=t[now].len。 从这题可以清楚了解后缀自动机fa指针的性质: 指向一个状态,这个状态的接受串s[x..x+i]是与当前状态的接受串后缀s[j-i..j]匹配是最长的一个。 这里是不是发现了一个和KMP很像的性质? KMP在失配时通过next数组回退,那么这...
分类:其他好文   时间:2014-08-15 21:11:29    阅读次数:281
SPOJ 220后缀数组:求每个字符串至少出现两次且不重叠的最长子串
思路:也是n个串连接成一个串,中间用没出现过的字符隔开,然后求后缀数组。 因为是不重叠的,所以和POJ 1743判断一样,只不过这里是多个串,每个串都要判断里面的最长公共前缀有没有重叠,所以用数组存下来就得了,然后再判断。 #include #include #include #include #include #include #include #include #include #defi...
分类:其他好文   时间:2014-08-15 16:02:09    阅读次数:194
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!