自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 收藏
  • 关注

原创 选择排序

public class SelectSort { public static int[] srot(int[] targe) { for (int i = 0; i < targe.length; i++) { int min = i; for (int j = i; j < targe.length; j++) { if (targe[j] < targe[min]) { ...

2020-05-09 08:02:49 119

原创 插入排序

import java.util.Arrays;public class InsertSort { public static int[] insert(int[] targe) { for (int i = 0; i < targe.length; i++) { int temp = targe[i]; while (i > 0 && targe[i - 1] > temp) { ...

2020-05-09 08:02:18 114

原创 选择排序

public class SelectSort { public static int[] srot(int[] targe) { for (int i = 0; i < targe.length; i++) { int min = i; for (int j = i; j < targe.length; j++) { if (targe[j] < targe[min]) { ...

2020-05-09 07:54:59 124

原创 插入排序

public class InsertSort { public static int[] insert(int[] targe) { for (int i = 0; i < targe.length; i++) { int temp = targe[i]; while (i > 0 && targe[i - 1] > temp) { targe[i] = targ...

2020-05-09 07:54:20 136

原创 冒泡排序

public class BubbleSrot { public static int[] sort(int[] targe) { boolean flag = true; for (int i = targe.length - 1; i > 0 && flag; i--) {// 外层循环表示本次内层循环要确定的最大或最小数的位置 flag = false; // 用来表内层循环是否发生交换,如果没有交换则说明数组已经...

2020-05-09 07:53:38 317

原创 60 n个骰子的点数

package sort;import java.util.Arrays;public class Test60 { public static void main(String[] args) { solution(4); } public static void solution(int n) { int sum = 0; int[] s = new int[n * 6 + 1]; solution(s, ...

2020-05-09 07:51:09 193

原创 59_2队列的最大值

package sort;import java.util.Deque;import java.util.LinkedList;public class Test59_2 { class inter { int value; int index; public inter(int value, int index) { // TODO Auto-generated constructor stub ...

2020-05-09 07:50:04 134

原创 59滑动窗口的最大值

package sort;import java.util.*;public class Test59 { public static void main(String[] args) { System.out.println(maxInWindows(new int[] { 2, 3, 4, 2, 6, 2, 5, 1 }, 3)); } public static ArrayList<Integer> maxInWindows(int[] n...

2020-05-09 07:49:07 144

原创 58 反转字符串

package sort;import java.util.Stack;public class Test58 { public static void main(String[] args) { System.out.println(ReverseSentence2("student. a am I")); } private static String ReverseSentence3(String string) { // TODO A...

2020-05-09 07:47:03 145

原创 57_2 和为s的连续正整数序列

package sort;import java.util.ArrayList;public class Test57_2 { public static void main(String[] args) { System.out.println(FindContinuousSequence(15)); } public static ArrayList<ArrayList<Integer>> FindContinuousSeque...

2020-05-09 07:45:43 149

原创 生产者 消费者

package sort;import java.util.*;public class ProducterAndConsumer { private final int MAX_LEN = 10; private volatile Queue<Integer> queue = new LinkedList<Integer>(); clas...

2020-05-04 10:06:03 89

原创 使用wait()/notify()实现三线程交替输出ABC

package sort;public class ThreeThread { volatile Object lock = new Object(); volatile Integer count = new Integer(0); class Thread1 extends Thread { @Override public vo...

2020-05-04 10:05:03 512 2

原创 Test57 和为s的数字

package sort;public class Test57 { public static void main(String[] args) { printnumber(new int[]{1,2,3,4,5,6,7,8,9,10},10 ); } public static void printnumber(int[] s, int targe)...

2020-04-08 08:57:33 195

原创 56_2 数组中唯一出现一次的数字

package sort;import java.util.Arrays;public class Test56_2 { public static void main(String[] args) { int[]e={3,3,3,4}; System.out.println(getn(e)); } public static...

2020-04-07 17:56:09 95

原创 56 数组中数字出现的次数

package sort;import javax.jws.Oneway;public class Test56 { public static void main(String[] args) { int[] s = { 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7 }; findSingle(s); } ...

2020-04-07 17:16:05 184 1

原创 55_2 判断平衡二叉树

package sort;public class Test55_2 { public static boolean isBalance(BinayTreeNode bt) { if (bt == null) return true; if (Math.abs(getdeepth(bt.left) - getdeepth(bt...

2020-04-07 17:10:03 91

原创 55二叉树的深度

package sort;public class Test55 { public static void main(String[] args) { int deepth = 1; BinayTreeNode root = new BinayTreeNode(1, null, null); makeTree(root, deepth)...

2020-04-07 17:06:33 92

原创 54 二叉搜索树中的第K大节点

package sort;public class Test54 { static int order = 0; public static void main(String[] args) { int deepth = 3; BinayTreeNode root = new BinayTreeNode(1, null, null); ...

2020-04-07 17:04:11 85

原创 53 1-n中缺失的数字

package sort;public class Test53_2 { public static void main(String[] args) { int[]a={0,1,2,3,5,6,7}; System.out.println(getFirstDisorder2(a)); } public st...

2020-04-07 17:00:29 148

原创 53 在排序数组中查找数字

package sort;public class Test53 { public static void main(String[] args) { int[] s = { 1, 2, 3, 3, 3, 3, 3, 4, 5, 6 }; System.out.println(getLast(s, 3, 0, s.length - ...

2020-04-06 10:16:04 110

原创 52 两个链表中的第一个公共节点

package sort;import java.util.Stack;public class Test52 { public static void main(String[] args) { ListNode a = new ListNode(1); ListNode b = new ListNode(2); ListNode...

2020-04-06 10:11:46 89

原创 51 数组中的逆序数对

package sort;import java.util.Arrays;public class Test51 { static int count = 0; public static void main(String[] args) { int[] s = new int[] { 1, 2, 3, 9, 8, 2, 0 }; coun...

2020-04-06 10:03:04 85

原创 50_2 删除字符串中重复出现的字符

package sort;import java.util.LinkedHashSet;public class Test50_3 { public static void main(String[] args) { System.out.println(depect("google")); } public static Strin...

2020-04-06 09:35:25 98

原创 50_1 从第一个字符串中删除第二个字符串出现过的字符

package sort;import java.util.HashSet;public class Test50_2 { public static void main(String[] args) { System.out.println(deepect("We are student", "aeiou")); } public static ...

2020-04-06 09:33:17 131

原创 50 第一次出现的字符串

package sort;import java.util.HashMap;import java.util.Iterator;import java.util.LinkedHashMap;import java.util.Map;public class Test50 { public static void main(String[] args) { S...

2020-04-06 09:14:10 99

原创 49 丑数

package sort;public class Test49 { public static void main(String[] args) { System.out.println(uglynumber(1500)); } public static int uglynumber(int n) { if (n < 6) ...

2020-04-06 08:48:25 70

原创 48 最长不含重复的子字符串

package sort;public class Test48 { public static void main(String[] args) { System.out.println(getlongest("arabcacfr")); } public static int getlongest(String str) { int...

2020-04-06 08:30:49 146

原创 47 礼物的最大价值

package sort;import java.util.ArrayList;public class Test47 { static int max = 0; public static void main(String[] args) { int[][] ss = { { 1, 10, 3, 8 }, { 12, 2, 9, 6 }, { 5, 7,...

2020-04-06 08:19:10 110

原创 46 把数字翻译成字符串

package sort;import java.util.ArrayList;public class Test46 { static int count = 0; public static void main(String[] args) { System.out.println(countString(12258)); } pu...

2020-04-06 07:59:34 110

原创 45 把数组排列成最小数

package sort;import java.util.ArrayList;import java.util.Collections;import java.util.Comparator;public class Test45 { public static void main(String[] args) { String[] str = { "21"...

2020-04-04 12:49:33 85

原创 44 数字系列中某一为的数字

package sort;public class Test44 { public static void main(String[] args) { System.out.println(getn(190)); } public static int getn(int n) { if (n <= 10) ...

2020-04-04 12:45:46 100

原创 43 1-n整数中出现1 的次数

package sort;public class Test43 { public static void main(String[] args) { System.out.println(findones(451)); //解析 https://blog.csdn.net/ds19980228/article/details/82748063...

2020-04-04 12:26:02 111

原创 42 连续子数组的最大和

package sort;public class Test42 { public static void main(String[] args) { int[]test={1,-2,3,10,-4,7,2,-5}; System.out.println(getMax(test)); } public static int getMax(...

2020-04-04 09:01:06 78

原创 41 数据流中的中位数

package sort;import java.util.Comparator;import java.util.PriorityQueue;public class Test41 { public static void main(String[] args) { int[] s = { 1, 2 }; System.out.println(...

2020-04-04 08:49:34 163

原创 40 最小的K个数

package sort;import java.util.Comparator;import java.util.PriorityQueue;public class Test40 { public static void main(String[] args) { int[] a = { 4, 5, 1, 6, 2, 7, 3, 8 }; in...

2020-04-04 08:23:18 65

原创 39 数组中出现次数超过一半的数字

package sort;public class Test39 { public static void main(String[] args) { int[]s={1,1,1,1,1,1,1,1,2,3,2,2,2,5,4,2}; System.out.println(findMoreThanHalf(s)); } ...

2020-04-04 07:55:34 62

原创 38_4 八皇后问题

package sort;import java.util.Arrays;public class Test38_4 { public static void main(String[] args) { PL(new int[] {0,1,2,3,4}); } public static void PL(int[] a) { PL...

2020-04-04 07:50:49 111

原创 38_3 把8个数放在正方体的8个顶点上

package sort;import java.util.Arrays;public class Test38_3 { public static void main(String[] args) { PL("ABCEFGHI"); } public static void PL(String str) { char[] ch =...

2020-04-04 07:47:39 342

原创 38_2 字符串的组合

package sort;import java.util.ArrayList;public class Test38_2 { public static void main(String[] args) { Combain("ABC"); } public static void Combain(String str) { ch...

2020-04-04 07:44:06 91

原创 37_2 反序列化二叉树

package sort;public class Test37_2 { public static int index = 0; public static void main(String[] args) { String test = "124$$$35$$6$$"; Test37.printTree(DisSerialied(test)...

2020-04-03 17:06:21 78

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除