码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
每日算法之二十九:Search in Rotated Sorted Array
在一个经过旋转后的有序数组中查找一个目标元素。 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search...
分类:其他好文   时间:2014-06-20 13:06:31    阅读次数:261
Convert Sorted Array to Binary Search Tree
题目 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 方法 数组是有序的,要求创建的二叉树尽量平衡,很容易想到对数组进行二分操作,左边的数组元素是左子树,右边的数组元素是右子树。进行递归操作就可以了。 TreeNode...
分类:其他好文   时间:2014-06-20 11:06:46    阅读次数:257
LeetCode: Balanced Binary Tree [110]
【题目】 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 of the two subtrees of every node never differ by more than 1. 【题意】 判断二叉树是否是平衡二叉树 【思路】 平衡二...
分类:其他好文   时间:2014-06-20 11:02:54    阅读次数:173
leetcode -day27 Recover Binary Search Tree & Interleaving String
1、 ?? 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...
分类:其他好文   时间:2014-06-20 10:13:49    阅读次数:243
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. 方法 和有序数组的思想基本一样,将链表进行二分。 TreeNode getBST(ListNode head, int len) { i...
分类:其他好文   时间:2014-06-20 09:46:33    阅读次数:267
Swift学习——A Swift Tour 枚举和结构体
Enumerations and Structures Enumerations   枚举的使用 使用 enum 定义一个枚举,枚举里面可以关联方法,比如下文中的描述方法 enum Rank: Int { case Ace = 1 case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten case Ja...
分类:其他好文   时间:2014-06-20 09:03:39    阅读次数:322
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 of the two subtrees of every node...
分类:其他好文   时间:2014-06-20 09:02:56    阅读次数:232
杭电OJ(HDU)-ACM Steps-Chapter Two-《Biker's Trip Odometer》《Climbing Worm》《hide handkerchief》《Nasty Hac》
杭电OJ(HDU)-ACM Steps-Chapter Two-《Biker's Trip Odometer》《Climbing Worm》《hide handkerchief》《Nasty Hac》...
分类:其他好文   时间:2014-06-07 11:39:31    阅读次数:315
即将开源,码晒客/疯狂创意二维码,个性二维码底层。
二维码:二维码(Two-dimensional code),又称二维条码,它是用特定的几何图形按一定规律在平面(二维方向)上分布的黑白相间的图形,是所有信息数据的一把钥匙。在现代商业活动中,可实现的应用十分广泛,如:产品防伪/溯源、广告推送、网站链接、数据下载、商品交易、定位/导航、电子凭证、车辆管...
分类:其他好文   时间:2014-06-07 08:05:10    阅读次数:269
leetcode--Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:其他好文   时间:2014-06-05 13:41:44    阅读次数:231
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!