自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Google I/O 2017上推出的新 GC 算法的原理

看了下youtube上的视频 https://www.youtube.com/watch?v=iFE2Utbv1Oo貌似之前的Compact Copying Collector并不是concurrent的,然后在Android O里调整成为了Concurrent Copying Garbage Collector. 新的GC简单来说就是利用了read barrier来使得应用程序代码可以在

2017-05-21 20:51:18 814

原创 背包问题整理

背包问题分为0/1背包,多重背包、完全背包这三大类下面给出6个常见的题目Backpack IProblem 单次选择+最大体积Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack?Notice

2017-04-11 17:56:27 613 1

原创 Python入门

最近由于公司的项目要用到swagger.py,需要用到python语言,由于时间比较急,就看了快速入门,下面总结下分享给大家基本语法面向对象概述面向过程:根据业务逻辑从上到下写垒代码函数式:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可面向对象:对函数进行分类和封装,让开发“更快更好更强...”面向过程编程最易被初学者接受,

2017-04-05 19:47:08 615

原创 trie树

最近在看字符串算法了,其中字典树、AC自动机和后缀树的应用是最广泛的了,下面将会重点介绍下这几个算法的应用。      字典树(Trie)可以保存一些字符串->值的对应关系。基本上,它跟 Java 的 HashMap 功能相同,都是 key-value 映射,只不过 Trie 的 key 只能是字符串。  Trie 的强大之处就在于它的时间复杂度。它的插入和查询时间复杂度都为 O(k) ,

2017-03-22 15:29:05 360

原创 并查集

其实并查集顾名思义就是有“合并集合”和“查找集合”两种操作的关于数据结构的一种算法。概述性质并查集算法不支持分割一个集合。算法用集合中的某个元素来代表这个集合,该元素称为集合的代表元。一个集合内的所有元素组织成以代表元为根的树形结构。对于每一个元素 parent[x]指向x在树形结构上的父亲节点。如果x是根节点,则令parent[x] = x。对

2017-03-22 11:57:33 352

原创 数据库回滚机制(RollBack)的实现

一、我们来看一个DML语句的处理过程描述update undotest set object_type='VIEW' where object_type='PROCEDURE';检查shared pool中是否存在相同的语句,如果存在,重用执行计划,执行扫描运算,如果不存在,执行硬解析生成执行计划根据执行计划中的扫描运算,检查undotest表中的相关数据块是否存在buffer

2016-11-28 20:45:47 37400

原创 ThreadPoolExecutor机制

ThreadPoolExecutor机制 一、概述 1、ThreadPoolExecutor作为java.util.concurrent包对外提供基础实现,以内部线程池的形式对外提供管理任务执行,线程调度,线程池管理等等服务; 2、Executors方法提供的线程服务,都是通过参数设置来实现不同的线程池机制。 3、先来了解其线程池管理的机制,有助于正确使用,避免错误使用导致严重故障

2016-11-22 21:20:10 465

原创 ThreadLocal介绍

在每个线程Thread内部有一个ThreadLocal.ThreadLocalMap类型的成员变量threadLocals,这个threadLocals就是用来存储实际的变量副本的,键值为当前ThreadLocal变量(即当前线程,所以threadlocals是与线程绑定的),value为变量副本(即T类型的变量)所以在线程池的时候可能产生脏数据的问题,一般在用threadlocal的时候

2016-09-27 19:53:27 418

转载 Java 并发工具包 java.util.concurrent 介绍

译序本指南根据 Jakob Jenkov 最新博客翻译,请随时关注博客更新:http://tutorials.jenkov.com/java-util-concurrent/index.html。本指南已做成中英文对照阅读版的 pdf 文档,有兴趣的朋友可以去 Java并发工具包java.util.concurrent用户指南中英文对照阅读版.pdf[带书签] 进行下载。

2016-09-27 19:21:38 683

原创 MachineLearning03_SVM算法

SVM分为线性和非线性的(其实线性就是非线性的一种特例)首先给出一个非常非常简单的分类问题(线性可分),我们要用一条直线,将下图中黑色的点和白色的点分开,很显然,图上的这条直线就是我们要求的直线之一(可以有无数条这样的直线)    假如说,我们令黑色的点 = -1, 白色的点 =  +1,直线f(x) = w.x + b,这儿的x、w是向量,其实写成这种形式也是等价的f(x) =

2016-07-22 21:47:45 757

原创 MachineLearning02_KNN(最近K邻算法)

kNN算法的指导思想是“近朱者赤,近墨者黑”,由你的邻居来推断出你的类别。1、指导思想kNN算法的指导思想是“近朱者赤,近墨者黑”,由你的邻居来推断出你的类别。计算步骤如下:    1)算距离:给定测试对象,计算它与训练集中的每个对象的距离(一般采用欧几里得距离)    2)找邻居:圈定距离最近的k个训练对象,作为测试对象的近邻    3)做分类:根据这k个近邻归属的主

2016-07-01 23:18:59 842

原创 MachineLearning01_DecisionTree(决策树)

分类树(决策树)是一种十分常用的分类方法。他是一种监管学习,所谓监管学习就是给定一堆样本,每个样本都有一组属性和一个类别,这些类别是事先确定的,那么通过学习得到一个分类器,这个分类器能够对新出现的对象给出正确的分类。这样的机器学习就被称之为监督学习。下面介绍用ID3算法构造决策树的过程(参考http://blog.csdn.net/acdreamers/article/details/

2016-07-01 23:04:20 5650

原创 Linux的文件类型

Linux一切皆文件,其文件类型分为以下几类1 普通文件 -2 文件夹  d3 链接文件 (1) 软连接 l(2) 硬链接 -4 特殊文件(1) 块设备 s(2)字符设备 c5 套接字文件(socket) s6 管道文件 p

2016-05-15 10:45:53 493

原创 微软研发类实习生面试

自己一直对微软有一种对bat没有的向往吧!所以很早就关注了微软的实习生招聘。想成为微软的intern必须经过以下环节 笔试+一轮电话面试+3轮现场面试(中间可能穿插着跟hr谈谈)1 笔试先说一下微软的笔试,微软所有的实习生都是必须参加笔试的无论是不是技术研发类的(只是笔试通过要求的分不一样而已),笔试就是4道acm题目,在我博客之前的文章中可以看到这四道题目,思维难道不大,但是在要求的

2016-05-02 23:36:45 13051 3

原创 按下开机键,电脑都做了哪些事

从打开电源到开始操作,计算机的启动是一个非常复杂的过程。先问一个问题,"启动"用英语怎么说?回答是boot。可是,boot原来的意思是靴子,"启动"与靴子有什么关系呢? 原来,这里的boot是bootstrap(鞋带)的缩写,它来自一句谚语:  "pull oneself up by one's bootstraps"字面意思是"拽着鞋带把自己拉起来",这当然是不可能的事情。最

2016-04-27 17:02:03 1613 1

原创 29. Divide Two Integers

Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.思路:采用累加法,设置一个sum和一个count,下面演示一下累加法的过程 比如26/5sum=5,count=1 dividend=26;sum=

2016-04-25 00:48:16 571

原创 151. Reverse Words in a String

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place 

2016-04-25 00:36:20 443

原创 179. Largest Number

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve

2016-04-25 00:22:01 330

原创 3. Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "

2016-04-24 20:36:36 336

原创 152. Maximum Product Subarray

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

2016-04-24 20:30:47 333

原创 324. Wiggle Sort II

Given an unsorted array nums, reorder it such that nums[0] nums[2] .Example:(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. (2) Given nums = [1, 3, 2, 2, 3

2016-04-24 20:20:51 643

原创 143. Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it t

2016-04-24 20:13:45 304

原创 61. Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.思路:旋转链表,非常常规的题了,只是需要注意k可能大于链表

2016-04-24 20:07:38 290

原创 5. Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.思路:i为中心位置向两边扩展,注意a

2016-04-24 19:59:09 276

原创 2. Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2016-04-24 19:54:57 266

原创 93. Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]. (Order

2016-04-24 19:50:29 301

原创 221. Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0

2016-04-24 19:47:28 227

原创 150. Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",

2016-04-24 19:39:58 281

原创 18. 4Sum

Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Element

2016-04-24 19:24:06 275

原创 228. Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].思路:设置一个start和end,开始时都指向0,然后end往后走,直到nums[end]!=nu

2016-04-24 19:18:28 246

原创 148. Sort List

Sort a linked list in O(n log n) time using constant space complexity.思路:可以参考归并排序的思想,一半一半的使之有序,然后归并代码如下(已通过leetcode)public class Solution {   public ListNode sortList(ListNode head) {    i

2016-04-24 19:15:14 265

原创 322. Coin Change

ou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money c

2016-04-24 19:11:58 277

原创 222. Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely fille

2016-04-24 19:05:24 307

原创 60. Permutation Sequence

The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""213""231""3

2016-04-24 18:59:31 281

原创 139. Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2016-04-24 18:47:26 245

原创 306. Additive Number

Additive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number in the

2016-04-24 18:39:41 242

原创 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]思路:

2016-04-24 18:35:57 315

原创 阿里菜鸟java岗面试

最近一直在忙微软的面试,今天下午突然接到了阿里的面试电话,整理一下问题,留个记录吧1 各种路径选择算法2 图论中的搜索算法3 红黑树和B树4 堆排序的建堆和按从小到大输出堆还有时间复杂度5 操作系统 死锁的四个条件 如何解决死锁6 线程可见性7 tcp的断开连接8 c++与java的不同,多继承单继承这些9 3类加载器和父加载机制10 jdk jar包用到的

2016-04-23 23:54:26 5571

原创 229. Majority Element II

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.思路: 跟majority element一样,还是投票法,因为求个数大于n/3的数字,我们知

2016-04-23 14:51:05 308

原创 209. Minimum Size Subarray Sum

Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the array [2,3

2016-04-23 14:45:38 272

空空如也

空空如也

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

TA关注的人

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