- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode : Binary Tree Postorder Traversal
vector postorderTraversal(TreeNode *root) { vector vec; vector vecResult; TreeNode *pointer=root; Node *pointer=getRoot(),*pre=NULL; while (pointer) { while (pointer->le
2014-05-21 18:07:02
351
原创 LeetCode : Binary Tree Preorder Traversal
vector preorderTraversal(TreeNode *root) { vector vec; vector vecResult; TreeNode *pointer=root; while(pointer||vec.empty()){ if(pointer){
2014-05-21 18:01:56
337
原创 LeetCode :Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
2014-05-21 18:00:18
328
原创 LeetCode : Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.
2014-05-21 17:48:50
344
原创 LeetCode : Sort List
Sort a linked list in O(n log n) time using constant space complexity.
2014-05-21 17:43:45
306
原创 LeetCode : Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
2014-05-21 17:42:24
355
原创 LeetCode:Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2014-05-18 14:01:35
320
转载 LeetCode: Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
2014-05-18 11:26:00
325
原创 LeetCode:Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For
2014-05-18 11:22:56
344
原创 LeetCode:Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
2014-05-18 11:21:25
298
原创 我的LeetCode第一弹 Leetcode: Two Sum
vector TwoSum(vector &numbers,int target){ int length=numbers.size(); vectorvec; if(length<2) return vec; std::multimap mp; multimap::iterator iter=mp.end(); multimap::iterator iter2=mp.
2014-05-17 15:57:50
416
原创 应用层各大协议
1 http协议(超文本传输协议)1.1cs架构1.2使用TCP传输1.3无状态协议(http不保存关于客户机的任何消息)1.4持久连接和非持久连接默认模式下的流水线方式的持久连接2 web缓存器条件get3 ftp协议3.1cs模式3.2 2个并行的TCP,控制连接21,数据连接203.3 非持久连接3.4必须在整个回话中保留用户的状态信息4
2014-04-10 21:27:05
616
原创 卡特兰数的研究
卡特兰数:1 通项公式:h(n)=C(n,2n)/(n+1)=(2n)!/((n!)*(n+1)!)2递推公式:h(n)=((4*n-2)/(n+1))*h(n-1); h(n)=h(0)*h(n-1)+h(1)*h(n-2)+...+h(n-1)*h(0).3前几项为:h(0)=1,h(1)=1,h(2)=2,h(3)=5,h(4)=14,h(5)=42,......
2014-04-08 10:35:21
581
原创 递归函数的解题思路
int ack(int m,int n){if(m == 0)return n + 1;else if(n == 0)return ack(m-1,1);elsereturn ack(m – 1 , ack(m , n-1));}如果ack(3,3),。结果为多少这是一个阿克曼函
2014-04-07 13:54:27
767
转载 关于栈的出栈顺序的研究
#include #include #include using namespace std;void func(int A[], int j, int n, vector &stk, vector &que){static int cnt = 0;if (j >= n){cout for (unsigned int k = 0; k cout
2014-04-07 11:32:19
418
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人