自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

mcrwayfun,欢迎你

种一棵树最好的时间是十年前,其次是现在

  • 博客(85)
  • 资源 (1)
  • 收藏
  • 关注

原创 HashMap中的indexFor是如何计算的

HashMap中的indexFor方法分析分析java7的HashMap源码的时候,其用indexFor来计算entry对象在table数组中的索引值 static int indexFor(int h, int length) { // assert Integer.bitCount(length) == 1 : "length must be a non-ze...

2018-08-15 10:22:52 1611

原创 栈的基本概念以及java实现栈

栈栈的基本概念栈的抽象类型顺序栈 构造函数 压栈 出栈 查询栈顶元素 判断栈是否为空 清空栈链式栈 构造函数 压栈 出栈 查询栈顶元素 判断栈是否为空 清空栈 顺序栈与链式栈的比较代码传送门,欢迎star:https://github.com/mcrwayfun/java-data-structure1. 栈的基本概念栈可以定义为只允许在表的...

2018-08-09 08:37:04 1871

原创 链表的基本概念以及java实现单链表-循环链表-双向链表

前言线性结构是非常简单且常用的数据结构,而线性表则是一种非常典型的线性结构。线性表定义线性表的数据结构链表 单链表 单链表的定义 单链表的插入和删除 单链表的遍历,清空,判空,获取指定结点 循环链表 循环链表的定义循环链表的插入和删除循环链表的遍历,清空双向链表 双向链表的定义双向链表的插入和删除本节代码传送门,欢迎star:https://github...

2018-07-19 21:21:44 1637

原创 深入了解java的装箱与拆箱

1 前言java是面向对象的语言,但是其也包含了8中基本数据类型,这8种数据类型不支持面向对象的编程机制,即不具备对象的特性,可以说是java语言早期设计的一种缺陷,为了解决8种基本数据类型的变量不能当成Object类型变量使用的问题,java提出了包装类(Wrapper class)的概念。本节主要了解:基本类型与包装类型之间的转换什么是装箱?什么是拆箱?装箱和拆箱是如何实现的装...

2018-07-16 00:37:40 2128

原创 Spring Boot常用注解

前言在学习springboot中,有一些注解经常用到,本节就具体讲下常用的注解以及如何使用。正文@SpringBootApplicationspringboot项目一般都会有一个*Application的入口类,入口类中会有一个main方法,这是一个标准的java应用程序的入口方法。入口类有一个核心的注解:@SpringBootApplication,来看一下截图:...

2018-07-03 21:02:29 9249

原创 树的基本概念以及java实现二叉树(二)

前言本文是我在学习了树后作的总结文章,接上篇文章,本节大致可以总结为:二叉树的遍历与实现(递归和非递归)获取二叉树的高度和度创建一棵二叉树其他应用(层序遍历,复制二叉树,判断二叉树是否相等)传送门:数据结构详解-树-java实现(一):https://mp.csdn.net/mdeditor/80637917 数据结构详解-树-java实现(二):正文4 二叉...

2018-07-01 21:02:19 8227 2

原创 树的基本概念以及java实现二叉树(一)

1 树什么是树 && 树的定义树的基本性质1.1 什么是树树是具有n个结点的有限集合,n=0时称为空树,在任意一棵非空树中,有如下性质 - 有且仅有一个结点被称为根结点(root) - 当n>1时,剩余结点可以分为m个任意不相交的有限集T1,T2

2018-06-10 01:11:10 23170 4

原创 Spring Boot基础教程汇总

1. 前言记录学习Spring Boot中的点滴,分享笔记以及源码。使用的版本分别为:spring boot 2.0.0.RELEASEspringframework 5.0.4.RELEASE项目源码,欢迎fork:https://github.com/mcrwayfun/spring-boot-learning2. 环境要求jdk1.8maven 3.2+选择一...

2018-05-12 19:56:49 7254

原创 使用数组和链表实现栈和队列的复杂度分析

​ 抽象数据类型(abstract data type,ADT)是带有一组操作的一些对象的集合1 表ADTA1,A2,⋯ ,ANA_1,A_2,\cdots,A_NA1​,A2​,⋯,AN​​ 如上,这是一个大小为N的表。当然,若N为0,则称其为空表。​ 对于除空表以外的任何表,A1可以看作是A2的前驱,而A2则是A1的后继。在一个表中,表中第一个元素是A1...

2018-11-13 23:32:04 2549 1

原创 深入了解Cookie

1. 前言朋友问我cookie是什么,用来干什么的,可是我居然无法清楚明白简短地向其阐述cookie,这不禁让我陷入了沉思:为什么我无法解释清楚,我对学习的方法产生了怀疑!在知乎上看到有人推荐使用费尔曼学习技巧,于是在重新学习cookie的过程中使用了该技巧来试验,效果有待验证!在学习一个新的知识点前,我们应该明白自己的学习目标,要带着疑问去学习,该小节须要了解: 1. 什么是c...

2018-09-04 22:18:47 425 4

原创 队列的基本概念以及java实现队列

队列队列的基本概念队列的抽象数据类型顺序队列 构造函数 入队 出队 查询front 获取队列长度 链式队列 构造函数 入队 出队 查询front 获取队列长度 循环列队 构造函数 入队 出队 查询front 获取循环队列的大小 判断队列是否为空 判断队列是否满 代码传送门,欢迎star:https://github.com/mcrwayfun/...

2018-08-21 00:09:56 352

原创 队列的基本概念以及java实现队列

队列队列的基本概念队列的抽象数据类型顺序队列 构造函数 入队 出队 查询front 获取队列长度 链式队列 构造函数 入队 出队 查询front 获取队列长度 循环列队 构造函数 入队 出队 查询front 获取循环队列的大小 判断队列是否为空 判断队列是否满 代码传送门,欢迎star:https://github.com/mcrwayfun/...

2018-08-16 22:42:33 1593 2

原创 java基本类型的转换分析

前言java有8种基本类型,分别有 基本数据类型 基本数据类型 byte char short float int double long boolean在java程序中,不同的类型需要进行转换。而转换有两种方式:自动转换和强制转换1. 自动类型的转换java中所有数值类型都可以互相转换,如下图所示:...

2018-08-09 08:33:17 194

原创 Baseball Game

Baseball GameDescriptionYou’re now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:Integer (one round’s score): Directly represents t...

2018-08-07 08:58:24 178

原创 First Bad Version

First Bad VersionDescriptionYou are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each...

2018-07-19 23:35:06 192

原创 Valid Anagram

Valid AnagramDescriptionGiven two strings s and t , write a function to determine if t is an anagram(相同字母异序词) of s.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:...

2018-07-19 23:34:01 158

原创 Delete Node in a Linked List

Delete Node in a Linked ListDescriptionWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3...

2018-07-19 23:32:45 163

原创 Palindrome Linked List

Palindrome Linked ListDescriptionGiven a singly linked list, determine if it is a palindrome.Example1:Input: 1->2Output: falseExample2:Input: 1->2->2->1Output:

2018-07-17 00:51:55 159

原创 Contains Duplicate

Contains DuplicateDescriptionGiven an array of integers, find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array, and it sho...

2018-07-17 00:50:18 172

原创 Split Linked List in Parts

Split Linked List in PartsDescriptionGiven a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list “parts”.The length of each part ...

2018-07-17 00:38:55 175

原创 Intersection of Two Linked Lists

Intersection of Two Linked ListsDescriptionWrite a program to find the node at which the intersection of two singly linked lists begins.Example 1:A: a1 → a2 ↘ ...

2018-07-15 18:58:25 170

原创 Remove Linked List Elements

Remove Linked List ElementsDescriptionRemove all elements from a linked list of integers that have value val.Example 1:Input: 1->2->6->3->4->5->6, val = 6Output: 1->...

2018-07-14 18:15:54 143

原创 Find Peak Element

Find Peak ElementDescriptionA peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.The...

2018-07-12 09:42:38 818

原创 Find Right Interval

Find Right IntervalDescriptionGiven a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval...

2018-07-11 08:51:35 146

原创 Reverse a singly linked list

Reverse a singly linked listDescriptionGiven a linked list, remove the n-th node from the end of list and return its head.Example1:Input: 1->2->3->4->5->NULLOutput: 5->4...

2018-07-05 01:09:04 451

原创 Rotate Array

Rotate ArrayDescriptionGiven an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Explanation:rotat...

2018-07-05 01:07:32 128

原创 Linked List Cycle

Linked List CycleDescriptionGiven a linked list, determine if it has a cycle in it.Tags: LinkedList解读题意判断该链表是不是存不存在环思路1定义两个指针,一个快一个慢。快指针每次移动两步,慢指针移动一步,若快慢指针在某处重合,则说明存在环。class...

2018-07-05 01:05:35 119

原创 Find Minimum in Rotated Sorted Array

Find Minimum in Rotated Sorted ArrayDescriptionSuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,...

2018-07-03 11:22:37 116

原创 Kth Smallest Element in a BST

Kth Smallest Element in a BSTDescriptionGiven a binary search tree, write a function kthSmallest to find the kth smallest element in it.**Note:**You may assume k is always valid, 1 ≤ k ≤ BST’s...

2018-06-29 00:03:36 1293

原创 Single Number

Single NumberDescriptionGiven a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Cou...

2018-06-27 21:39:03 150

原创 Valid Palindrome

Valid PalindromeDescriptionGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note:For the purpose of this problem, we define empty ...

2018-06-27 21:37:55 1313

原创 Best Time to Buy and Sell Stock II

Best Time to Buy and Sell Stock IIDescriptionSay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may comp...

2018-06-27 21:37:04 125

原创 Convert Sorted Array to Binary Search Tree

Convert Sorted Array to Binary Search TreeDescriptionGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary t...

2018-06-27 21:35:54 1347

原创 Maximum Depth of Binary Tree

Maximum Depth of Binary TreeDescriptionGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf ...

2018-06-27 21:34:59 153

原创 4Sum II

4Sum IIDescriptionGiven four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A,...

2018-06-27 20:34:10 3974

原创 Binary Tree Level Order Traversal

Binary Tree Level Order TraversalDescriptionGiven a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).Example 1: For example, Given ...

2018-06-26 23:21:46 169

原创 Symmetric Tree

Symmetric TreeDescriptionGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).Example 1: For example, this binary tree [1,2,2,3,4,4,3] is symmetric:...

2018-06-26 23:19:24 116

原创 Validate Binary Search Tree

Validate Binary Search TreeDescriptionGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows: - The left subtree of a node contains only n...

2018-06-26 23:17:33 3948

原创 Sqrt(x)

Sqrt(x)DescriptionImplement int sqrt(int x).Compute and return the square root of x, where x is guaranteed to be a non-negative integer.Since the return type is an integer, the decimal digits ...

2018-06-26 23:14:07 157

原创 Merge Sorted Array

Merge Sorted ArrayDescriptionGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and...

2018-06-25 21:57:49 191

空空如也

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

TA关注的人

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