07 2015 档案

摘要:连接MySQL 查看MySQL 操作MySQL 阅读全文
posted @ 2015-07-28 17:25 Sawyer Ford 阅读(164) 评论(0) 推荐(0)
摘要:题目描述:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space? 这题思路就是把单链表的前半部分或后半部分反转,然后比较。s... 阅读全文
posted @ 2015-07-25 18:35 Sawyer Ford 阅读(188) 评论(0) 推荐(0)
摘要:题目描述:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipe... 阅读全文
posted @ 2015-07-24 21:04 Sawyer Ford 阅读(208) 评论(0) 推荐(0)
摘要:题目描述: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 s... 阅读全文
posted @ 2015-07-23 22:36 Sawyer Ford 阅读(161) 评论(0) 推荐(0)
摘要:题目描述:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ... 阅读全文
posted @ 2015-07-23 21:30 Sawyer Ford 阅读(177) 评论(0) 推荐(0)
摘要:最近在学习Nginx,记录一下自己的学习历程。1.Nginx开发从入门到精通 (淘宝技术团队编写,值得一看)2. 《深入理解Nginx:模块开发与架构解析》3.Nginx模块开发入门 (教你用Nginx写"Hello World")4.Nginx源码剖析之内存池,与内存管理5.nginx源码... 阅读全文
posted @ 2015-07-21 16:27 Sawyer Ford 阅读(156) 评论(0) 推荐(0)
摘要:1. 赛马问题: 一共有25匹马,有一个赛场,赛场有5个赛道,就是说最多同时可以有5匹马一起比赛。假设每匹马都跑的很稳定,不用任何其他工具,只通过马与马之间的比赛,试问,最少得比多少场才能知道跑得最快的5匹马?(不能使用撞大运的算法)解析:http://hxraid.iteye.com/blog/... 阅读全文
posted @ 2015-07-20 17:27 Sawyer Ford 阅读(6375) 评论(0) 推荐(0)
摘要:全部内容来自《剑指offer》。题目一: 输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变。为简单起见,标点符号和普通字符一样处理。例如输入字符串“I am a student.”,则输出“student. a am I”。ANSWER:void reverse(char *pB... 阅读全文
posted @ 2015-07-18 19:04 Sawyer Ford 阅读(179) 评论(0) 推荐(0)
摘要:直接上代码了struct BTNode { int val; BTNode *lchild; BTNode *rchild; BTNode(int x): val(x), lchild(NULL), rchild(NULL){}};BTNode* rebuildBinTr... 阅读全文
posted @ 2015-07-15 20:36 Sawyer Ford 阅读(147) 评论(0) 推荐(0)
摘要:公式如下: 递归的解法我就不写了,贴一个递推的。long long Fibonacci(unsigned int n){ if (n <= 0) return 0; if (n == 1) return 1; long long a = 0; l... 阅读全文
posted @ 2015-07-14 19:34 Sawyer Ford 阅读(170) 评论(0) 推荐(0)
摘要:题目描述: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).Find the minimum eleme... 阅读全文
posted @ 2015-07-13 19:47 Sawyer Ford 阅读(167) 评论(0) 推荐(0)
摘要:1. 二分查找//递归版int binarySearch(const int arr[], int low, int high, int val){ if (low arr[mid]) return binarySearch(arr, mid+1, high, val)... 阅读全文
posted @ 2015-07-12 15:10 Sawyer Ford 阅读(289) 评论(0) 推荐(0)