给定两个分别由字母组成的字符串A和字符串B,字符串B的长度比字符串A短。请问,如何最快地判断字符串B中所有字母是否都在字符串A里?简单起见,约定只出现小写字符。 代码: package alg; import java.util.Arrays; /** * @author zha * 字符串包含 *...
分类:
其他好文 时间:
2014-12-03 22:50:37
阅读次数:
297
收集的排列加组合的各种算法,还有待完善:
一.利用二进制状态法求排列组合,此种方法比较容易懂,但是运行效率不高,小数据排列组合可以使用
import java.util.Arrays;
//利用二进制算法进行全排列
//count1:170187
//count2:291656
public class test {
public static void main(S...
分类:
编程语言 时间:
2014-12-03 14:16:32
阅读次数:
310
前言 在Java中,有很多封装好的类可以用来操纵数组(排序,复制等等),使得数组使用起来非常的方便。这就是高级语言带来的好处。代码示例 - 一维数组package test;import java.util.Arrays;public class Test { public static v...
分类:
编程语言 时间:
2014-12-03 12:00:35
阅读次数:
190
Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
分类:
其他好文 时间:
2014-12-02 19:08:20
阅读次数:
209
题目描述: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sho....
分类:
其他好文 时间:
2014-12-02 18:57:38
阅读次数:
213
1import java.util.*;public class asList{ public static void main(String args[]) { // int arr[] = {1,2,3,4,45}; // List list = Arrays...
分类:
编程语言 时间:
2014-12-01 20:44:04
阅读次数:
189
import java.util.Arrays;public class HelloWorld { //完成 main 方法 public static void main(String[] args) { int[] scores={89 , -23 , 64 , 91 , 119 , 52 ,....
分类:
编程语言 时间:
2014-12-01 19:14:01
阅读次数:
188
import java.util.Arrays;public class HelloWorld { public static void main(String[] args) { // 创建对象,对象名为hello HelloWorld hello = new HelloWorld(); ...
分类:
编程语言 时间:
2014-12-01 17:35:06
阅读次数:
205
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:
其他好文 时间:
2014-11-30 19:56:07
阅读次数:
103
Lua学习笔记之tables与bjects
1、 table是Lua中唯一的数据结构,其他语言提供的其他数据比如:arrays、records、lists、queues、sets等,Lua都是通过table来实现的。
2、 数组
在Lua中通过整数下标访问表中的元素即可简单的实现数组,并且数组不必事先指定大小,大小可以随需要动态的增长。
通常我们初始化数组的时候就间接的定义了数组的大小...
分类:
其他好文 时间:
2014-11-29 18:57:57
阅读次数:
130