![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
文章平均质量分 50
带你环游world
这个作者很懒,什么都没留下…
展开
-
Maximum Depth of Binary Tree
Problem:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for binary t原创 2014-01-02 23:14:35 · 540 阅读 · 0 评论 -
Same Tree
Problem:Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the sa原创 2014-01-03 13:36:11 · 478 阅读 · 0 评论 -
Single Number I
Problem:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have alinear runtime complexity. Could you implement it withou原创 2014-01-02 16:39:38 · 429 阅读 · 0 评论 -
Unique Binary Search Trees
Problem:Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example:Given n = 3, there are a total of 5 unique BST's.初看这道题目,感原创 2014-01-03 23:10:37 · 451 阅读 · 0 评论 -
Reverse Integer
Problem:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321class Solution {public: int reverse(int x) { vector tem; while(x!=0){原创 2014-01-03 21:01:56 · 511 阅读 · 0 评论 -
Max Subarray
Max SubArray内容:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarra原创 2014-02-13 09:26:28 · 549 阅读 · 0 评论 -
Merge Sorted Array
Merge Sorted Array内容:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of原创 2014-02-13 09:41:00 · 467 阅读 · 0 评论 -
Reverse Words in a String
Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the原创 2014-09-05 21:59:08 · 584 阅读 · 0 评论 -
字符串哈希函数
基本概念所谓完美哈希函数,就是指没有冲突的哈希函数,即对任意的 key1 != key2 有h(key1) != h(key2)。设定义域为X,值域为Y, n=|X|,m=|Y|,那么肯定有m>=n,如果对于不同的key1,key2属于X,有h(key1)!=h(key2),那么称h为完美哈希函数,当m=n时,h称为最小完美哈希函数(这个时候就是一一映射了)。在处理大规模字符串数据时,转载 2014-09-09 20:48:23 · 373 阅读 · 0 评论