题目
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 subarray [4,...
分类:
其他好文 时间:
2014-06-19 12:08:20
阅读次数:
270
题目
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 maximum jump length at that position.
...
分类:
其他好文 时间:
2014-06-19 11:46:47
阅读次数:
277
最近在启动监听器的时候收到了TNS-01201: Listener cannot find executable...的错误提示。这个错误还真是一个一直没有碰到过的错误。咋一看还真不明白是怎么一回事呢。下面是错误的具体描述与解决方案。1、故障描述#在启动监听器时收到了TNS-01201错误,监听器无法找到可执行文件oracle@DevDB02:~> lsnrctl start LISTENER_U...
分类:
其他好文 时间:
2014-06-19 11:36:26
阅读次数:
408
题目
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 maximum jump length at that position.
...
分类:
其他好文 时间:
2014-06-19 10:05:39
阅读次数:
278
集合类是一种将各相同类型的对象集合起来的类,数组实质上也是集合类型中的一种。
集合主要是以线性结构存储结构
C#提供ArrayList类、Queue类、Stack类
1.ArrayList类简介:
ArrayList类可以动态地添加和删除元素。
ArrayList类相当于一种高级的动态数组,是Array类的升级版本,但它并不等同于数组。
2.与数...
分类:
其他好文 时间:
2014-06-19 09:55:19
阅读次数:
229
一、由编译器生成的成员函数
1)默认的构造函数
默认构造函数定义为没有参数,或者有默认的参数值。当用户自己未定义时,系统可以提供。
自动生成的默认构造函数,会调用继承的基类的默认构造函数来构造派生类的基类部分。
若Star是一个类,则
Star orig;
Star array[6];都将需要默认构造函数。
如果自己定义了构造函数,则系统不会再生成默认构造函数,这个时候最好自己要定义...
分类:
编程语言 时间:
2014-06-16 12:23:39
阅读次数:
262
旋转数组中的查找。[1, 2, 3, 4, 5, 6]的一个旋转数组为[4, 5, 6, 1, 2, 3]。在旋转数组中寻找一个数。
最直接的方法,一次遍历,时间复杂度O(n)。但是既然是一个部分有序的数组,那么对于有序的部分我们可以想方法用二分查找。这个效率可以提高。
代码:
.......
分类:
其他好文 时间:
2014-06-15 17:33:21
阅读次数:
195
qianya
上次被出了一题质数的C语言求解题目,当时用了最粗暴的算法,回来仔细参考资料,其实答案有很多种:
1,小学生版本:判断 x 是否为质数,就从 2 一直算到 x-1。
static rt_uint32_t array1[ARRAY_LEN];
void func1(void)
{
for (rt_uint32_t i = 1; i
{
a...
分类:
编程语言 时间:
2014-06-15 17:23:51
阅读次数:
412
题目
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target i...
分类:
其他好文 时间:
2014-06-15 16:53:32
阅读次数:
177
题目
Given a sorted array of integers, find the starting and ending position of a given target value.
解题思路:
查找一个数出现的范围,给一个排好序的数组和一个数,找出这个数在数组中出现的范围。
这个题直接使用一次遍历就可以得到结果,这样的时间复杂度为O(n)。但是对于有序数组我们一般可以使用二分查找可以得到更好的O(logn)的时间复杂度。我们可以使用二分查找找到这个数第一次出现的位置和这个数最后一次出现的位...
分类:
其他好文 时间:
2014-06-15 16:19:16
阅读次数:
237