自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 多线程笔试题

/** * 两个线程交替输出1--100 * @auther plg * @date 2019/5/12 22:05 */public class Print implements Runnable { private int num = 1; @Override public void run() { while(true){ synchronized (this){ this.notify();

2022-10-30 11:07:30 132 1

原创 排序算法(自用)

各类排序算法比较排序时间复杂度O(nlogn) ~ O(n^2)主要有:冒泡排序,选择排序,插入排序,归并排序,堆排序,快速排序等。冒泡排序实现:比较相邻的元素。如果第一个比第二个大,就交换它们两个;对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对,这样在最后的元素应该会是最大的数;针对所有的元素重复以上的步骤,除了最后一个;重复步骤1~3,直到排序完成。优点:实现简单,n较小时性能较好代码:public static void bubbleSort(int[] arr) {

2021-10-13 17:30:58 113

原创 两数之和+LUR

牛客简单题1.两数之和使用hashmap解决 public int[] twoSum(int[] nums, int target) { Map<Integer, Integer> m = new HashMap<>(); for (int i = 0; i < nums.length; i++) { if (m.get(target - nums[i]) != null) {

2021-10-11 20:55:44 106

原创 关于二进制的算法

二进制中1的个数输入一个整数 n ,输出该数32位二进制表示中1的个数。其中负数用补码表示。public int NumberOf1(int n) { int count=0; while(n!=0){ count++; n=n&(n-1); } return count; } 如果一个整数不为0,那么这个整数至少有一位是1。如果我们把这个整数减1,那么原来处在整数

2021-09-28 09:11:14 352

原创 Divide and Conquer15

标题

2021-07-03 11:14:38 48

原创 Duplicate Calculation in Recursion14

Duplicate Calculation in RecursionMemoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. (Source: wikipedia

2021-06-30 18:36:31 84

原创 redis笔记整理

NoSql:not noly sql泛指非关系型数据库特点:方便扩展大数据量高性能数据类型是多样性的,不需事先设计数据库NoSql四大分类:kv键值对 redis文档型数据库列存储数据库图关系数据库redis:remote dictionary server远程服务字典定义:c语言编写,支持网络,可基于内存可持久化的日志型,kv数据库特性:多样的数据类型持久化集群事务有16个数据库,默认使用第0个redis的单线程的,但速度还是快的redis是将所有的数据全部放在内存

2021-06-29 15:12:50 70

原创 Principle of Recursion13

Principle of Recursion

2021-06-26 11:12:31 60

原创 Conclusion12

ConclusionConstruct Binary Tree from Inorder and Postorder TraversalGiven two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the same tree, construct and return the

2021-06-25 19:50:05 61

原创 Solve Tree Problems Recursively11

Solve Tree Problems RecursivelyMaximum Depth of Binary TreeA binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.class Solution { int max=0; private void maximum_depth(TreeN

2021-06-15 17:18:14 50

原创 Binary Tree Preorder Traversal10

a

2021-06-14 09:44:34 62

原创 Doubly Linked List09

Doubly Linked ListDesign Doubly Linked ListDesign your implementation of the linked list. You can choose to use a singly or doubly linked list.A node in a singly linked list should have two attributes: val and next. val is the value of the current node,

2021-06-10 11:35:53 104

原创 Reverse Linked List08

Reverse Linked ListGiven the head of a singly linked list, reverse the list, and return the reversed list.

2021-06-10 09:48:31 51

原创 single linked list&Two Pointer Technique

single linked list

2021-06-01 17:54:45 45

原创 Conclusion

ConclusionHeight CheckerA school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected

2021-05-31 08:27:45 81

原创 in-Place Operations

in-Place OperationsReplace Elements with Greatest Element on Right Sidepublic int[] replaceElements(int[] arr) { for (int i=0;i<arr.length;i++){ int Gnum=-1; for (int j=i+1;j<arr.length;j++){ if(arr[j

2021-05-27 12:53:08 72

原创 Searching for Items in an Array

ArrayCheck If N and Its Double ExistGiven an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M).public boolean checkIfExist(int[] arr) { boolean flag=false; for (int a :

2021-05-26 09:45:10 49

原创 Deleting Items Froms an Array

ArrayRemove ElementGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.T

2021-05-25 17:36:09 75

原创 Inserting Items Into an Array

ArrayDuplicate ZerosGiven a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right.Note that elements beyond the length of the original array are not written.public void duplicateZeros(int[]

2021-05-24 12:11:56 71

原创 Introduction01

ArrayMax Consecutive OnesGiven a binary array nums, return the maximum number of consecutive 1’s in the array. public int findMaxConsecutiveOnes(int[] nums) { int count = 0; int[] result =new int[nums.length]; int

2021-05-23 16:26:39 95

原创 java容器面试题(自用)

java容器面试题(自用)1.ArrayList和LinkedList,Vector,Array的区别 1.ArrayList底层数据结构为数组,LinkedList底层数据结构为链表,前者查询效率高,增删效率低,后者查询操作性能比较低 2.Vector是线程安全的,类中有许多synchronized进行修饰,因此,效率较低。空间不足时,可设置增长因子 但其实比较鸡肋,它的两个优点都可被替代。线程安全可使用CopyOnWriteArrayList,集合元素较

2021-05-11 18:54:52 138

原创 mybatis脑图

mybatis脑图链接:https://mm.edrawsoft.cn/map.html?sharecode=606d9ef13d6532a54969740

2021-04-07 20:01:49 82

原创 js基本笔记

JavaScript1.运行在客户端的脚本语言2.组成:ECMAScript,DOM,BOM3.var是一个JS关键字,用来声明变量4.js是一种弱类型语言(动态语言)   变量的数据类型是由JS引擎根据=右边变量   值的数据类型来判断的,拥有动态类型,意    味着相同的变量可用作不同的类型5.简单数据类型   Number:isNaN()判断是否为非数字   String:

2021-04-02 16:50:25 63

原创 java基础脑图

Java基础脑图网址:https://mm.edrawsoft.cn/map.html?sharecode=6062a385a02fb8a36253060

2021-03-30 12:06:18 62

原创 java.util.Date与java.sql.date与Timestamp与String的转换

java.util.Date与java.sql.date与Timestamp与String的转换在进行数据库操作时,经常会对java.util.Date与java.sql.Date转换1.java.util.Date与java.sql.Date结果实质为java.util.Date转为long在转为java.sql.Date实质为java.sql.Date转为long在转为java.util.Date2.java.util.Date与Timestamptimestamp是java.sql

2021-03-16 20:54:54 231

原创 ## maven中一个子项目颜色为棕色

maven中一个子项目颜色为棕色右击直接点击Unigonre Project即可

2021-03-12 20:37:56 218

原创 java-TreeMap

java-TreeMap问题来源TreeMap的实现是红黑树算法的实现1.先了解红黑树a.红黑树是一颗自平衡的排序二叉树。b.节点为红色或黑色的平衡二叉树c.具体规则d.红黑树的三大操作:左旋,右旋,着色2.TreeMap数据结构TreeMap的一个重要属性比较器a.如题,构造一个比较器new TreeMap<>();则使用默认的比较器b.也可new TreeMap<>(Comparator<? super K> comparator);则使

2021-02-10 11:22:56 130

原创 数据结构简单脑图

数据结构简单脑图https://kdocs.cn/l/ccjT1uZQtYfY[金山文档] React.pof

2020-12-30 19:52:40 288

原创 数组的声明与初始化

数组的声明与初始化问题由来int[] arrays;// arrays = {1,2};// arrays = int[2];// arrays = int[] {1,2}; int[] arr=new int[] {2,3};数组arrays声明后,无法进行初始化(或者说是我不知道如何进行初始化,qaq~)深层剖析1.初始化分为静态初始化和动态初始化静态:int[] a = {1,2,3,4,5};动态:int[] b=new int[5];2.数组一定需要初始化

2020-12-21 10:28:18 903

空空如也

空空如也

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

TA关注的人

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