排序的稳定性:如果Ki=Kj,且排序前的序列中i<j,如果排序后,i<j,则排序方法是稳定的;反之,如果i>j,则排序方法是不稳定的。 1、冒泡排序 2、选择排序 ...
分类:
编程语言 时间:
2018-08-17 22:17:06
阅读次数:
120
108. Convert Sorted Array to balanced Binary Search Tree The tricky part is the base case . Write induction part first and then test arrays of differe... ...
分类:
其他好文 时间:
2018-08-17 00:33:49
阅读次数:
150
方法一:使用Arrays.asList()方法String[] strs = {"one","two","three"};List<String> strList = Array.asList(strs);注意:1)这个方法返回的是基于数组的List视图,并未正在的创建List对象,所以不能对Lis ...
分类:
编程语言 时间:
2018-08-16 23:01:10
阅读次数:
201
在回顾正则表达式之前,我们先来回顾一下前边讲的 String ,先看几个简单的练习题吧!! 练习: 1. 输入字符串,然后再输入 2 个数字(一个表示起始位置,一个表示结束位置),按照指定的数字截取一个字符串 package cn.tedu.string; import java.util.Scan ...
分类:
其他好文 时间:
2018-08-16 19:37:41
阅读次数:
181
1 package demo; 2 import java.util.Arrays; 3 public class Demo { 4 public static void main(String[] args) { 5 int[] a={15,45,1,5,48,66,44,12}; 6 Array ...
分类:
编程语言 时间:
2018-08-16 00:40:44
阅读次数:
120
显然我们有一个比较简单的构图 对于s[1...n]为回文串,我们可以1->n连边,2->n-1连边以此类推(这里的连边都是无向边) 显然如果n个点在同一个联通块中那么是合法的 首先我们先考虑无解情况 显然对于一张n个点的图,如果边数<n-1那么这张图一定不连通 所以如果a和b加起来奇数值大于2了,那 ...
分类:
其他好文 时间:
2018-08-15 22:50:00
阅读次数:
219
1 RAID: 2 Redundant Arrays of Inexpensive Disks 3 Redundant Arrays of Independent Disks 独立冗余磁盘阵列 4 5 Berkeley: A case for Redundent Arrays of Inexpens... ...
分类:
其他好文 时间:
2018-08-15 21:36:10
阅读次数:
163
数组排序除了和c++里面相同的手写的冒泡排序和选择排序,同样也支持sort函数,sort函数在util.Arrays包里面 下面上代码 ...
分类:
编程语言 时间:
2018-08-15 17:00:31
阅读次数:
135
List<String> menuPathlist = new ArrayList<String>(); List<String> menuIds = menuPathlist.stream().map(line -> line.split("/")).flatMap(Arrays::stream) ...
分类:
编程语言 时间:
2018-08-15 14:55:37
阅读次数:
176
Description: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time ...
分类:
其他好文 时间:
2018-08-14 16:17:51
阅读次数:
155