题目描述:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
代码:
int Solution::strStr(char *haystack, char *needle)
{
...
分类:
其他好文 时间:
2014-11-18 11:47:35
阅读次数:
161
At first , you should download Phalcon DLL file.You can download from this link under.http://static.phalconphp.com/files/phalcon_x86_VC9_php5.3.9_1.3....
【算法思路】时间复杂度限制在O(n log n),我们可以第一时间想到常用的二路归并排序,快速排序和堆排序,其中快排和堆排只适用于线性表,即数组,故这道编程题毫无疑问用二路归并排序;
【编程步骤】
* 1. 利用一个小技巧,可以设置慢行指针low和快行指针fast,把链表分成两部分来操作,即first和second链表
* 2. 递归排序first和second链表,即
first=sortList(head);
second=sortList(second);
* 3. 合并这两个链表,即:...
分类:
其他好文 时间:
2014-11-18 10:23:15
阅读次数:
185
在2.10中的inplace_swap函数的基础上,你决定写一段代码,实现将一个数组中的元素两端依次对调,你写出下面这个函数: 1 void reverse_array(int a[], int cnt) 2 { 3 int first, last; 4 for(first = 0,...
分类:
移动开发 时间:
2014-11-18 00:18:15
阅读次数:
267
俗话说得好,线性表(尤其是链表)是一切数据结构和算法的基础,很多复杂甚至是高级的数据结构和算法,细节处,除去数学和计算机程序基础的知识,大量的都在应用线性表。一、栈其实本质还是线性表:限定仅在表尾进行插入或删除操作。 俗称:后进先出 (LIFO=last in first out结构),也可说是先进...
分类:
编程语言 时间:
2014-11-18 00:17:18
阅读次数:
257
Interval
时间限制:2000 ms | 内存限制:65535 KB
难度:4
描述
There are n(1
Each query contains an integer xi(-100000
输入The first line of input is the number of test case.
For each test case,...
分类:
编程语言 时间:
2014-11-17 22:51:54
阅读次数:
204
题目描述
Problem B: Alaska
The Alaska Highway runs 1422 miles from Dawson Creek, British Columbia to Delta Junction, Alaska. Brenda would like to be the first person to drive her new elect...
分类:
其他好文 时间:
2014-11-17 22:51:11
阅读次数:
278
原文地址:http://www.cnblogs.com/zhili/p/SingletonPatterm.html一、引言最近在设计模式的一些内容,主要的参考书籍是《Head First 设计模式》,同时在学习过程中也查看了很多博客园中关于设计模式的一些文章的,在这里记录下我的一些学习笔记,一是为了...
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu...
分类:
其他好文 时间:
2014-11-17 09:11:26
阅读次数:
235
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu...
分类:
其他好文 时间:
2014-11-17 08:06:17
阅读次数:
210