到目前为止, 我们已经学习到了插入排序, 冒泡排序, 选择排序(selection)。 这些排序算法都是comparision based sorting algorithms(即涉及到元素大小的比较来决定元素的先后顺序)。 而且算法的时间复杂度上均为O(n^2)。但是comparision based 的排序算法远非这几个算法。 而且可以通过利用其它的一些手段(例如divide and conq...
分类:
编程语言 时间:
2014-07-11 08:29:25
阅读次数:
441
Example XHTML page
以上例子展示,通过 xmlns 来指定命名空间,通过 xmlns:prefix 来指定 前缀,一但指定的前缀,就得在当前元素,以及子元素使用。
有时候为了避免不同语言间的冲突,也需要使用命名空间来限定特性,如下面的例子所示。
Example XHTML page
Hello world!...
分类:
编程语言 时间:
2014-07-11 00:51:47
阅读次数:
339
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3...
分类:
其他好文 时间:
2014-07-11 00:51:05
阅读次数:
195
Android中的测试无非是分为两种:一、在一个工程里面写测试代码。二、专门新建一个工程写测试代码。一、在一个工程里面写测试代码步骤:1、写一个类继承AndroidTestCase如:package com.example.junittest;
import junit.framework.Assert;
import android.test.AndroidTestCase;
public ...
分类:
移动开发 时间:
2014-07-10 22:59:54
阅读次数:
331
题目描述:
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
For example,
Given:
s1 = "aabcc",
s2 = "dbbca",
When s3 = "aadbbcbcac", return
true.
When s3 = "aad...
分类:
其他好文 时间:
2014-07-10 21:15:16
阅读次数:
166
Coin Change
Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.
For example, if ...
分类:
其他好文 时间:
2014-07-10 21:12:39
阅读次数:
158
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
For example, given
s = "leetcode",
dict = ["leet"...
分类:
其他好文 时间:
2014-07-10 20:57:26
阅读次数:
215
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it t...
分类:
其他好文 时间:
2014-07-10 20:43:37
阅读次数:
210
Android中对操作的文件主要可以分为:File、XML、SharedPreference。这篇博客主要介绍对File的操作:1、MainActivitypackage com.example.filetest;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
impor...
分类:
移动开发 时间:
2014-07-10 17:13:57
阅读次数:
255
nvi更纯正,接近原始的vicommand argument-F don't copy whole file, may faster-S securehelp (quick reference):exusage:viusageinit/etc/vi.exrc => ~/.nexrc or ~/.ex...
分类:
其他好文 时间:
2014-07-10 15:54:09
阅读次数:
166