码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
Binary Search (二分查找)
思路就是砍一半, 适用于sorted array.时间复杂度O(lgn).每次都是取中间的跟target比较, 比target小的话目标值肯定在lower和mid之间, 比target大的话在mid和high之间~ 1 public int binarySearch(int num[], int t...
分类:其他好文   时间:2015-02-16 11:29:26    阅读次数:131
109.Convert Sorted List to Binary Search Tree Leetcode Python
Convert Sorted List to Binary Search Tree Total Accepted: 32343 Total Submissions: 117376 My Submissions Question Solution  Given a singly linked list where elements are sorted in ascending order, co...
分类:编程语言   时间:2015-02-16 09:04:34    阅读次数:193
Convert Sorted List to Binary Search Tree java
1 public TreeNode sortedListToBST(ListNode head) { 2 if(head==null) return new TreeNode(0); 3 ArrayList arr=new ArrayList(); 4 ...
分类:编程语言   时间:2015-02-16 00:20:04    阅读次数:230
[LeetCode]Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note...
分类:其他好文   时间:2015-02-15 18:12:12    阅读次数:175
【LeetCode从零单排】No67.AddBinary
题目Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".代码public class Solution { public String addBinary(String a, String b) { S...
分类:数据库   时间:2015-02-15 18:11:30    阅读次数:220
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:其他好文   时间:2015-02-15 16:26:22    阅读次数:118
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:其他好文   时间:2015-02-15 14:54:50    阅读次数:165
MySQL的零碎知识点
用binary解决mysql数据大小写敏感问题:BINARY不是函数,是类型转换运算符,它用来强制它后面的字符串为一个二进制字符串,可以理解为在字符串比较的时候区分大小写。MySQL特别是4.*以前的对于中文检索会有不准确的问题,可以在检索的时候加上binary,4.*之后的版本就不需要了。MySQ...
分类:数据库   时间:2015-02-15 12:10:18    阅读次数:205
leetcode 108. Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.[Solution] 1 TreeNode *sortedArrayToBST(vector &num) ...
分类:其他好文   时间:2015-02-14 22:27:21    阅读次数:220
Linux 学习笔记
Linux学习笔记1. 常用命令命令存放,哪些命令可以执行?root:/sbin/usr/sbinall users:/bin/usr/binbin--binary 二进制文件Linux所有都是文件,都是二进制文件usr—usersbin—super binary文件处理命令1ls英文原意是list...
分类:系统相关   时间:2015-02-14 20:01:45    阅读次数:244
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!