从JDK1.0开始,Integer中就定义了MIN_VALUE和MAX-VALUE两个常量:/** * A constant holding the minimum value an {@code int} can * have, -231. */public static final int MI...
分类:
编程语言 时间:
2015-06-12 11:31:03
阅读次数:
165
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.
pop() – Removes the element on top of the stack.
top() – Get the...
分类:
其他好文 时间:
2015-06-12 10:11:48
阅读次数:
115
Sort a linked list in O(n log n) time using constant space complexity.分析:题目要求时间复杂度为O(nlogn),所以一开始想到的就是快速排序,但是快速排序一直AC不了,然后就想到用归并排序,没想到归并排序竟然可以。下面给出详细代码:归并排序需要做的
找到中间点
合并两个排好序的链表
递归实现归并排序
Code(c++):/**...
分类:
其他好文 时间:
2015-06-10 14:15:10
阅读次数:
102
Sort a linked list in O(n log n)
time using constant space complexity.
算法一 自顶向下折半归并,递归
使用递归。进行折半。
先使用快慢指针,找到中间结点。将链表一分为二。
对此两链表进行递归排序后,进行归并。
在leetcode上实际执行时间为62ms。
/**
* Definition for...
分类:
其他好文 时间:
2015-06-08 09:57:20
阅读次数:
118
Sort a linked list inO(nlogn) time using constant space complexity.链表排序,要求时间复杂度O(nlgn),我写的归并排序。/** * Definition for singly-linked list. * public class...
分类:
其他好文 时间:
2015-06-07 17:18:21
阅读次数:
131
warning:deprecated conversion from string constant to ‘char *’ 解决方案#include
using namespace std;int fuc(char *a)
{
cout << a << endl;
}
int main()
{
fuc("hello");
}Linux 环境下当GCC版本比较高...
分类:
其他好文 时间:
2015-06-07 01:05:11
阅读次数:
138
onStartCommand()是由Android系统调用的,本质上也是调用了onStart()方法。
onStartCommand()返回值有几种:
1)START_STICKY
英文解释:
Constant to return from onStartCommand: if this service's process is killed while it is started...
分类:
移动开发 时间:
2015-06-06 15:01:40
阅读次数:
156
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov...
分类:
编程语言 时间:
2015-06-05 19:37:00
阅读次数:
147
CREATE OR REPLACE PROCEDURE ModifyColumnTypeIS sqlRenameColumn CONSTANT VARCHAR2(100) := 'alter table [tablename] rename column [targetcolumn] to [tar...
分类:
其他好文 时间:
2015-06-05 15:29:58
阅读次数:
97
PL/SQL结构分为三块:declare、begin、exception。其中begin必不可少。块一:declare的作用是申明变量,包括变量的名称及其相关属性和是否定义初始值。其相关属性包括数据类型,长度。 其初始值定义时可以用:=也可以用default,当用constant对数据类型进行修饰之...
分类:
数据库 时间:
2015-06-05 12:15:16
阅读次数:
178