自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 排序--快速排序

/** * 快速排序 * 在arr中指定一个数k 在数组中划分3个区域 >k; ==k; <k; * 递归 */ public class QuickSort { public static void main(String[] args) { int[] arr = new int[]{13, 334, 23, 5, 34, 23, 4, 65, 7, 4, 5, 23, 4, 565, 76, 4, 54, 53, 45, 234, 54}; .

2022-03-28 10:09:12 55

原创 排序--归并排序

import java.awt.print.PrinterGraphics; /** * 排序--归并排序 * 先使子序列有序,在合并得到完全有序 */ public class MergeSort { // 递归方法 public static void mergeSort(int[] arr) { if (arr == null || arr.length < 2) { return; } pro..

2022-03-21 11:27:13 393

原创 链表反转--单链表与双链表的反转

/** * 链表反转--单链表与双链表的反转 * */ public class ReverseList { //单链表 public static class Node{ int val ; Node next; public Node(int va){ this.val = va; } } //双链表 public static class DoubleNode{ ..

2022-03-18 15:26:17 487

原创 简单算法--二分查找

package com.hc.aglorithmhc; import java.util.Arrays; /** * 二分查找 * 在有序数组中查找是否存在特定的k值 * */ public class BinarySearch { public static boolean binarySearch(int[] arr , int k){ if (arr == null || arr.length == 0){ return false; .

2022-03-18 11:23:04 718

原创 简单排序--插入排序

/** * 简单排序--插入排序 * 遍历数组 做到0 到 i 有序 * */ public class InsertSort { public static void insertSort(int[] arr){ if (arr == null || arr.length < 2){ return; } for (int i = 1; i < arr..

2022-03-17 16:16:09 245

原创 简单排序-- 冒泡排序

/** * 简单算法-排序 冒泡排序 * 0到n-1 遍历 两两比较 较大的数往后交换 * */ public class BubbleSort { public static void bubbleSort(int[] arr){ if (arr == null || arr.length < 2){ return; } for (int i = arr.length - 1; i >= 0 ; i--).

2022-03-17 14:46:29 64

原创 简单算法 - 排序 选择排序

package algorithm; /** * 简单排序-选择排序 * 从0开始到n-1位置找到最小值与i位置交换 * */ public class SelectionSort { public static void selectSort(int[] arr){ for (int i = 0; i < arr.length - 1; i++) { int min = i; for (int j = i + 1; j.

2022-03-16 11:31:30 37

空空如也

空空如也

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

TA关注的人

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