自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 平时项目笔记

【代码】平时项目笔记。

2022-11-29 13:43:18 69 1

原创 力扣题目练习

2022-06-12 22:10:41 63

原创 Floyd算法

package TestFloyed;import java.util.Arrays;/** * 尚硅谷 */public class FloydAlgorithm { public static void main(String[] args) { char[] vertex = {'A', 'B', 'C', 'D', 'E', 'F', 'G'}; int[][] matrix = new int[vertex.length][verte...

2021-12-11 19:46:24 699

原创 迪克斯特拉算法

package Test;import java.util.Arrays;/** * 尚硅谷 */public class DijkstraAlgorithm { public static void main(String[] args) { char[] vertex = {'A', 'B', 'C', 'D', 'E', 'F', 'G'}; int[][] matrix = new int[vertex.length][vertex.leng.

2021-12-10 18:53:59 408

原创 递归的理解

package test;//递归public class test { public static void main(String[] args) { int sum = sum(3); System.out.println(sum); f(10); } public static int sum(int n) { if (n <= 1) { return n; .

2021-12-09 19:54:34 142

原创 克鲁斯卡尔

package Test;import java.util.Arrays;/** * 跟着尚硅谷写的 */public class KruskalCase { private int edgeNum; private char[] vertexs; private int[][] matrix; private static final int INF = Integer.MAX_VALUE; public static void main(Stri.

2021-12-08 18:03:40 160

原创 定义泛型类

package Fanse;public class Test<T> { private T t; public T getT() { return t; } public void setT(T t) { this.t = t; } public static void main(String[] args) { //指明范型 Test<String> tes.

2021-12-08 17:05:58 169

原创 二叉搜索树(中序遍历)

public boolean isValidBST(TreeNode root) { //定义一个栈 Deque<TreeNode> deque = new LinkedList<>(); //比较的值(第一次循环时小于取出的第一节点的值) double inorder = -Double.MAX_VALUE; //栈不为空当前根节点的值不等于null while (!deque.i...

2021-12-06 20:16:26 314

原创 java贪心算法

package Test;import java.util.ArrayList;import java.util.HashMap;import java.util.HashSet;/** * 尚硅谷 */public class Test { public static void main(String[] args) { //创建广播电台,放入到Map HashMap<String, HashSet<String>> br.

2021-12-05 20:29:43 242

原创 kmp算法

package sy1;import java.util.Arrays;/** * 尚硅谷 */public class KMPAlgorithm { public static void main(String[] args) { String str1 = "BBC ABCDAB ABCDABCDABDE"; String str2 = "ABCDABD"; int[] next = kmpNext(str2); S.

2021-12-04 17:25:41 164

原创 字符串(暴力匹配)

package sy1;public class ViolenceMatch { public static void main(String[] args) { String str1 = "AAB AAABBB AABBXX"; String str2 = "AABBXX"; int index = violenceMatch(str1, str2); System.out.println("index=" + index);.

2021-12-04 15:55:40 437

原创 汉洛塔问题

package sy1;public class Hanoitower { public static void main(String[] args) { hanoiTower(2, 'A', 'B', 'C'); } public static void hanoiTower(int num, char a, char b, char c) { //只有一个盘 if (num == 1) { Syst.

2021-12-03 20:59:17 4205

原创 二分查找(非递归)

package sy1;public class BinarySearchNoRecur { public static void main(String[] args) { int[] arr = {1, 3, 8, 10, 11, 67, 100}; int i = binarySearch(arr, 100); System.out.println(i); } //二分查找 public static int b.

2021-12-03 18:45:57 297

原创 二叉树的深度(最大最小)

package sy1;import java.util.Deque;import java.util.LinkedList;import java.util.Queue;public class test { public static void main(String[] args) { TreeNode root = new TreeNode(3); TreeNode node1 = new TreeNode(9); TreeNo.

2021-12-03 18:34:16 74

原创 104. 二叉树的最大深度

package sy1;import java.util.LinkedList;import java.util.Queue;public class test { public static void main(String[] args) { TreeNode root = new TreeNode(3); TreeNode node1 = new TreeNode(9); TreeNode node2 = new TreeNode(.

2021-12-01 21:10:57 360

原创 图的入门案例与深度与广度优先遍历

package sy1;import java.util.ArrayList;import java.util.Arrays;/** * 跟着尚硅谷写的 */class graph { public static void main(String[] args) { int n = 5; //结点的个数 String[] Vertexs = {"A", "B", "C", "D", "E"}; graph graph = new g.

2021-11-30 20:43:41 133

原创 实现顺序存储二叉树遍历

package Tree;public class Test { public static void main(String[] args) { int[] arr = { 1, 2, 3, 4, 5, 6, 7 }; Tree t=new Tree(arr); t.order(); }}class Tree{ private int[] arr; //初始化 public Tree (int[] arr){.

2021-11-28 21:08:05 136

原创 226. 翻转二叉树

package sy5;public class Test { public static void main(String[] args) { TreeNode root = new TreeNode(4); TreeNode node1 = new TreeNode(2); TreeNode node2 = new TreeNode(7); TreeNode node3 = new TreeNode(1); T.

2021-11-28 18:26:45 36

原创 平衡二叉树的旋转

package sy4;public class Test1 { public static void main(String[] args) {// int[] arr = {4, 3, 6, 5, 7, 8}; int[] arr = {10, 11, 7, 6, 8, 9}; C c = new C(); for (int i = 0; i < arr.length; i++) { c.add.

2021-11-27 19:39:26 327

原创 110. 平衡二叉树

package sy4;import java.awt.*;public class Test { public static void main(String[] args) { TreeNode root=new TreeNode(3); TreeNode node1=new TreeNode(9); TreeNode node2=new TreeNode(20); TreeNode node3=new TreeNode(.

2021-11-26 21:46:41 175

原创 二叉树的删除

package sy3.sy;import javax.print.attribute.standard.NumberUp;import java.util.PriorityQueue;import java.util.function.ObjDoubleConsumer;//节点类public class TreeNode { int val; TreeNode left; TreeNode right; public TreeNode(int val) .

2021-11-26 20:56:50 628

原创 二叉树的创建

package sy3.sy;//节点类public class TreeNode { int val; TreeNode left; TreeNode right; public TreeNode(int val) { this.val = val; } /** * 添加节点的方法 * * @param node */ public void add(TreeNode node) {.

2021-11-25 21:39:38 246

原创 力扣83.删除链表中的重复元素

package sy3;import java.util.HexFormat;public class Test1 { public static void main(String[] args) { ListNode l1 = new ListNode(1); ListNode l2 = new ListNode(1); ListNode l3 = new ListNode(3); ListNode l4 = new Lis.

2021-11-10 19:32:44 695

原创 实现快速排序

package sy3;import java.util.Arrays;public class Test { public static void main(String[] args) { int[] arr = {90, 2, 43, 2, 1, 45, 8}; int i = 0; int j = arr.length - 1; paixu(arr, i, j); System.out.println(Arr...

2021-11-10 19:14:17 354

空空如也

空空如也

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

TA关注的人

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