码迷,mamicode.com
首页 >  
搜索关键字:elements    ( 4737个结果
php实现堆排序
针对堆排序的概念自己百度去,今天没事了用php实现堆排序的算法 1 abstract class Heap { 2 protected $elements = array(); 3 protected $n = 0; 4 5 public abstract func...
分类:编程语言   时间:2015-03-28 22:59:45    阅读次数:149
Spiral Matrix II -- leetcode
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ ...
分类:其他好文   时间:2015-03-28 17:17:30    阅读次数:124
[LeetCode 78] Subsets
题目链接:subsets import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Given a set of distinct integers, S, return all possible subsets. Note: Elements in a su...
分类:其他好文   时间:2015-03-28 08:50:46    阅读次数:100
LeetCoode—**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. 我想如果只是表示成二叉树,没有什么难度,但是如果是表示为平衡二叉树那么可能就有难度了 要求左右子树的高度是均衡的 先给出自己的解法,很low,就是现将节点都保存在vector...
分类:其他好文   时间:2015-03-21 17:10:11    阅读次数:158
[Leetcode] Maximum Gap
Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/spac...
分类:其他好文   时间:2015-03-21 16:49:56    阅读次数:121
【LeetCode】Recover Binary Search Tree 解题报告
【题目】 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Could...
分类:其他好文   时间:2015-03-21 12:42:54    阅读次数:129
LeetCode Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [...
分类:其他好文   时间:2015-03-21 12:41:11    阅读次数:105
Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:其他好文   时间:2015-03-21 12:39:00    阅读次数:177
LeetCode OJ Convert Sorted Array to Binary Search
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. class Solution { public: vector Num; TreeNode *sortedArrayToBST(vector &num) { if (num.size() == 0) r...
分类:其他好文   时间:2015-03-21 11:24:00    阅读次数:169
hdu4267分组线段树
http://acm.hdu.edu.cn/showproblem.php?pid=4267 Problem Description Let A1, A2, ... , AN be N elements. You need to deal with two kinds of operations. One type of operation is to add a give...
分类:其他好文   时间:2015-03-21 09:45:51    阅读次数:141
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!