自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 STS搭建Maven项目,创建springboot项目

STS搭建maven项目,创建springboot项目

2022-01-30 20:15:14 3773

原创 Mybatis的一级、二级缓存

mybatis默认开启一级缓存,同一个sqlSession多次查询同一个namespace+id时,只会第一次查询数据库,后面的查询将直接从一级缓存中读取。当执行sqlSession.commit()时,会刷新一级缓存,也就是清空一级缓存,如果此时开启了二级缓存,则会将一级缓存的结果写入二级缓存中保存。mybatis的二级缓存需要设置才能开启。首先需要在mybatis-config.xml的settings标签中添加<setting name="cacheEnabled" value="t

2021-09-21 22:45:23 552

原创 Oracle SQL优化

[b]一.SQL语句优化[/b][b]1.建议不用 * 来代替所有列名[/b]Oracle系统会通过查询数据字典来将 * 转换成表的所有列名,会消耗系统时间[b]2.用 truncate 代替 delete [/b]delete 删除数据行时,Oracle会使用撤销表空间(undo tablespace)来存放恢复的信息,如果用户一直不执行commit语句,被删除的数据行将一直占用撤销表空间。当使用 truncate 时,系统不会将被删除的数据写到回滚段(或撤销表空间)中,速度就会快很多。[b]3

2020-10-17 19:01:57 154

原创 递归函数——头递归和尾递归

学习总结自《像程序员一样思考》V.Anton Spraul 著,徐波 译递归,也就是一个函数直接或间接调用自身。一般来说,递归可以分为直接递归和间接递归。直接递归,是指函数自己调用自己的情况,而间接递归,是指调用其他函数时,在其他函数中又调用了自己的情况。现在,主要将递归分为头递归和尾递归来学习。1.概念头递归:递归发生在函数的其他处理代码之前(或理解为,递归发

2017-11-30 16:52:03 4936 3

原创 Java开发之道

整理自《Java开发之道》明日科技、张振坤、李钟尉、陈丹丹等编著,电子工业出版社出版一、陷进1. for循环中删除数组的所有元素for(int i=0;i<l.size();i++){ l.remove(i);}在这个循环中,由于每次循环都删掉了数组中的元素,导致 l.size()变化,不能达到最初的目的。2. 浮点数的比较和相减会因为精度的原因导致很大的误差,需要小心对待。

2017-11-30 10:16:21 284

转载 Java——内部类

参考资料 《Java编程思想》 Java内部类的使用小结 【解惑】领略Java内部类的“内部”目录: 1. 普通内部类 (成员内部类) 2. 局部内部类 3. 匿名内部类 4. 嵌套类(Static内部类)内容: 1. 普通内部类(成员内部类) 成员内部类,就是作为外部类的成员,可以直接使用外部类的所有成员和方法,即使是private的。 同时外部类要访问内部类的所有成员变量/

2017-10-30 14:12:40 182

转载 JVM——类加载器

转载自点击打开链接Class文件由类装载器装载后,在JVM中将形成一份描述Class结构的元信息对象,通过该元信息对象可以获知Class的结构信息:如构造函数,属性和方法等,Java允许用户借由这个Class相关的元信息对象间接调用Class对象的功能。虚拟机把描述类的数据从class文件加载到内存,并对数据进行校验,转换解析和初始化,最终形成可以被虚拟机直接使用的Java

2017-10-03 09:05:52 219

原创 数据库——事务

1. 事务概念构成单一逻辑工作单元的操作集合称为事务。由begin transaction 和end transaction 之间执行的全体操作组成。2. ACID 特性Atomicity 原子性:要么全执行,要么全不执行。Consistency 一致性:食物事务执行前后,数据库都处于一致状态,一致性要求超出包含了数据完整性约束(主码约束,参照完整性,check约束等)。

2017-10-02 15:17:58 355

原创 数据库知识点梳理

1. 基本概念a 数据库管理系统(DBMS):由一个互相关联的数据的集合和一组用来访问这些数据的程序组成,是一种操纵和管理数据库的软件,用于建立、使用和维护数据库。b 数据库(DB):按照数据结构来组织、存储和管理的数据的集合,也就是数据库管理系统中的数据的集合。c 数据库系统(DBS):为适应数据处理的需要而发展起来的一种较为理想的数据处理系统,是一个为实际可运行的存储、维护和应用系

2017-09-30 21:26:04 1459

转载 HashMap的工作原理

转自 点击打开链接 ,译文链接 点击打开链接,译者:ImportNew.com- 唐小娟HashMap的工作原理是近年来常见的Java面试题。几乎每个Java程序员都知道HashMap,都知道哪里要用HashMap,知道Hashtable和HashMap之间的区别,那么为何这道面试题如此特殊呢?是因为这道题考察的深度很深。这题经常出现在高级或中高级面试中。投资银行更喜欢问这

2017-09-24 17:24:52 154

原创 浅谈 Stack 和 Queue 的比较学习

Stack1. 背景介绍java.util.Stack继承的类,从根类到Stack的树是java.lang.Object         java.util.AbstractCollection                  java.util.AbstractList                            java.util.Vector

2017-09-24 09:42:55 542

转载 Java与C++的区别

参考: 点击打开链接点击打开链接Java与C++都是面向对象的语言,都使用了面向对象的思想(封装、继承、多态)。1. 指针Java语言去掉了C++中的指针,防止了指针操作失误带来的一系列麻烦,但也不是说JAVA没有指针,虚拟机内部还是使用了指针,只是外人不得使用而已。这有利于Java程序的安全。2. 多重继承C++支持多重继承,支持public继承、private继

2017-09-22 09:35:53 236

转载 Map学习

转自点击打开链接对于 Map1. Map 中Key 和 Value是否存在boolean constainsKey(K key) : 含有键值key,返回trueboolean constainsValue(V value) : 如果map中有键值对应value,返回true2.  Map 的get、put方法V get (K key) :得到 key 对应的val

2017-09-21 16:01:55 463

原创 剑指offer 中做了又错的题目

剑指offer 25 和LeetCode 113题打印二叉树中路径和为s的所有路径

2017-09-18 13:03:39 465

原创 最小排序(美团点评)

美团点评-测试开发 第一道 AC未通过,事后改正

2017-09-14 21:53:26 393

原创 KMP算法

李春葆版本的《数据结构》中KMP算法笔记

2017-09-14 17:45:20 302 1

转载 LRU和LFU的区别

转自点击打开链接1. LRU  (Least Recently Used)最近最少使用页面置换核心思想:如果数据最近被访问过,那么将来被访问的可能性也更高。实现:1) 新数据插入链表头部;2) 每当缓存命中,则将命中数据移到链表头部;3) 当链表满时,将链表尾部数据丢弃。2. LFU  (Least Frequently Used)最近最不常用使用页面置换核心思想:

2017-09-13 18:00:39 1996

原创 二叉搜索树的后续遍历序列

输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍public class Solution { public static boolean VerifySquenceOfBST(int [] sequence) { if(sequence==null || sequence.length==0){ return false;

2017-09-13 10:13:57 155

原创 树的子结构

输入两棵二叉树A,B,判断B是不是A的子结构。(ps:我们约定空树不是任意一个树的子结构)/**public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val;

2017-09-13 10:10:26 162

转载 LeetCode 34. Search for a Range

Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the ta

2017-09-06 10:31:47 166

原创 算法概论习题解答8.22

8.22 问题描述: 在任务调度,常常会用到图。其中节点应用于任务,任务i到j的有向边表示i是j的先期条件。这样的图描述了调度问题中的任务先后关系(约束) 。显然,一个调度是可行的当且仅当该图无环;如果调度不可行,我们需要使其无环所需的最小约束数量。给定一个有向图G =(V,E),子集E'⊆E称为一个反馈弧集,反馈弧集是指将其移除后,将使得G无环。反馈弧集(FAS):给定一个有向图

2017-07-05 22:03:23 688

原创 LeetCode 109. Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST。解题思路:对于一个给定个数的有序列表,其形成的平衡二叉树的形状只与它的个数有关,与具体的数值无关。首先可以先计算链表中节点的总个数,然后将中间节点构造成子树根节点,递归构造左右子

2017-06-27 16:34:46 211

转载 LeetCode 516. Longest Palindromic Subsequence

转载自 点击打开链接class Solution {public: int longestPalindromeSubseq(string s) { if(s.length()==0){ return 0; }else{ int len=s.length(); int **dp;

2017-06-27 11:03:15 192

转载 LeetCode 72. Edit Distance

Given two words word1 and word2, find the minimum number of steps required to convertword1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:

2017-06-21 20:13:00 160

转载 LeetCode 435. Non-overlapping Intervals

Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval's end point is alway

2017-06-16 15:58:26 253

原创 LeetCode 455. Assign Cookies

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a coo

2017-06-16 09:56:16 151

原创 LeetCode 392. Is Subsequence

Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s andt. t is potentially a very long (length ~= 500,000) stri

2017-06-16 09:50:41 160

原创 LeetCode 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], theref

2017-06-11 20:46:26 154

原创 LeetCode 64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right whichminimizes the sum of all numbers along its path.Note: You can only move either down or right at

2017-06-11 16:08:37 184

原创 LeetCode 213. House Robber II

Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time

2017-06-11 15:44:21 203

转载 LeetCode 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.

2017-06-07 14:24:01 161

转载 LeetCode 169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appearsmore than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alw

2017-06-07 10:55:37 154

原创 LeetCode 63. Unique Paths II

Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.

2017-06-05 15:44:03 146

原创 LeetCode 121. Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2017-06-05 13:18:10 184

原创 LeetCode 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2017-06-05 12:37:11 166

原创 LeetCode 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo

2017-06-05 10:59:09 146

转载 LeetCode 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positi

2017-06-05 10:26:25 191

转载 LeetCode 6. ZigZag Conversion

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I

2017-06-04 17:25:23 166

原创 LeetCode 53. Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] has

2017-05-30 00:02:52 208

转载 155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Ge

2017-05-25 21:31:50 186

空空如也

空空如也

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

TA关注的人

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