- 博客(53)
- 资源 (1)
- 收藏
- 关注
原创 LIS longest Increasing subarray 最长递增子序列
对于前面i个元素的任何一个递增子序列,如果这个子序列的最大的元素比array[i+1]小,那么就可以将array[i+1]加在这个子序列后面,构成一个新的递增子序列。 比如当i=4的时候,目标序列为:1,-1,2,-3,4,-5,6,-7最长递增序列为:(1, 2),(-1, 2)。那么,只要4>2,就可以把4直接增加到前面的子序列形成一个新的递增子序列。因此,我们希望找到前i个元素
2015-07-31 21:41:15 398
原创 [leetcode]Find Minimum in Rotated Sorted Array II
From : https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-tim
2015-07-31 10:00:29 280
原创 [leetcode] Search a 2D Matrix II
From : https://leetcode.com/problems/search-a-2d-matrix-ii/Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in
2015-07-28 20:45:32 333
转载 分布数数据库事物
随着商业需求的日益增加,应用程序变得越来越复杂,经常需要访问多个数据库,这些数据库通常分布在不同的地方,这就是分布式事务。分布式事务修改的数据存储在多个或多种类型的数据源中,这些数据源分布在多台机器上,甚至更复杂的情况。Innodb存储引擎支持XA事务,通过XA事务可以支持分布式事务的实现。分布式事务指的是允许多个独立的事务资源(transactional resources)参与一个全局的事
2015-07-28 10:27:58 470
转载 数据库ACID
一.事务 定义:所谓事务,它是一个操作序列,这些操作要么都执行,要么都不执行,它是一个不可分割的工作单位。 准备工作:为了说明事务的ACID原理,我们使用银行账户及资金管理的案例进行分析。 [sql] view plaincopyprint?// 创建数据库 create t
2015-07-28 09:25:04 316
转载 数据库索引简介
1、索引定义 数据库索引好比是一本书前面的目录,能加快数据库的查询速度。索引是对数据库表中一个或多个列(例如,employee 表的姓氏 (lname) 列)的值进行排序的结构。如果想按特定职员的姓来查找他或她,则与在表中搜索所有的行相比,索引有助于更快地获取信息。2、建立索引的优缺点:优点: 1.大大加快数据的检索速度; 2.创建唯一性索引,保证数据库表中
2015-07-27 21:34:34 483
转载 设计模式总结
一、设计模式的分类总体来说设计模式分为三大类:创建型模式,共五种:工厂方法模式、抽象工厂模式、单例模式、建造者模式、原型模式。结构型模式,共七种:适配器模式、装饰器模式、代理模式、外观模式、桥接模式、组合模式、享元模式。行为型模式,共十一种:策略模式、模板方法模式、观察者模式、迭代子模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式、中介者模式、解释器模式
2015-07-27 19:29:00 447
转载 JVM java 监控工具-命令行
查看JVM各个参数值方式1. HotSpot vm中的各个globals.hpp文件 查看jvm初始的默认值及参数globals.hpp globals_extension.hpp c1_globals.hpp c1_globals_linux.hpp c1_globals_solaris.hpp c1_globals_sparc.hp
2015-07-26 19:44:11 363
转载 JVM java监控-可视化
1.JConsole JConsole工具在JDK/bin目录下,启动JConsole后,将自动搜索本机运行的jvm进程,不需要jps命令来查询指定。双击其中一个jvm进程即可开始监控,也可使用“远程进程”来连接远程服务器。进入JConsole主界面,有“概述”、“内存”、“线程”、“类”、“VM摘要”和"Mbean"六个页签:
2015-07-26 19:43:44 448
转载 JVM java对象引用强度
无论是通过计数算法判断对象的引用数量,还是通过根搜索算法判断对象引用链是否可达,判定对象是否存活都与“引用”相关。引用主要分为 :强引用(Strong Reference)、软引用(Soft Reference)、弱引用(Weak Reference)、虚引用(PhantomReference) 四种,引用的强度依次骤减。强引用:就是指在代码之中普遍存在的,
2015-07-26 19:43:23 343
转载 JVM 内存管理
对象优先在Eden上分配大多数情况下,对象优先在新生代Eden区域中分配。当Eden内存区域没有足够的空间进行分配时,虚拟机将触发一次 Minor GC(新生代GC)。Minor GC期间虚拟机将Eden区域的对象移动到其中一块Survivor区域。大对象直接进入老年代所谓大对象是指需要大量连续空间的对象。虚拟机提供了一个XX:P
2015-07-26 16:35:42 375
转载 JVM 垃圾收集器介绍
HotSpot JVM收集器 上面有7中收集器,分为两块,上面为新生代收集器,下面是老年代收集器。如果两个收集器之间存在连线,就说明它们可以搭配使用。Serial(串行GC)收集器Serial收集器是一个新生代收集器,单线程执行,使用复制算法。它在进行垃圾收集时,必须暂停其他所有的工作线程(用户线程)。是Jvm client模式下默认的
2015-07-26 16:32:43 322
转载 JVM 垃圾收集算法
跟踪收集器跟踪收集器采用的为集中式的管理方式,全局记录对象之间的引用状态,执行时从一些列GC Roots的对象做为起点,从这些节点向下开始进行搜索所有的引用链,当一个对象到GC Roots 没有任何引用链时,则证明此对象是不可用的。下图中,对象Object6、Object7、Object8虽然互相引用,但他们的GC Roots是不可到达的,所以它们将会被判定为是可回收的对象。
2015-07-26 16:31:47 318
转载 JVM 对象访问
对象访问会涉及到Java栈、Java堆、方法区这三个内存区域。如下面这句代码:[java] view plaincopyprint?Object objectRef = new Object(); 假设这句代码出现在方法体中,"Object objectRef” 这部分将会反映到Java栈的本地变量中,作为一个re
2015-07-26 16:31:35 352
转载 JVM内存模型
一:Java技术体系模块图二:JVM内存区域模型1.方法区也称"永久代” 、“非堆”, 它用于存储虚拟机加载的类信息、常量、静态变量、是各个线程共享的内存区域。默认最小值为16MB,最大值为64MB,可以通过-XX:PermSize 和 -XX:MaxPermSize 参数限制方法区的大小。
2015-07-26 16:26:00 354
原创 [leetcode] Jump Game II
From : https://leetcode.com/problems/jump-game-ii/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents y
2015-07-23 20:23:48 244
原创 [leetcode] Longest Consecutive Sequence
From : https://leetcode.com/problems/longest-consecutive-sequence/Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100,
2015-07-23 10:16:31 278
原创 [leetcode] Reverse Nodes in k-Group
from : https://leetcode.com/problems/reverse-nodes-in-k-group/Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a
2015-07-22 16:48:57 294
原创 [leetcode] Trapping Rain Water
From : https://leetcode.com/problems/trapping-rain-water/Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able t
2015-07-21 22:07:03 279
原创 【leetcode】 Edit Distance
From:https://leetcode.com/problems/edit-distance/Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 s
2015-07-20 21:05:30 393
原创 【leetcode】Repeated DNA Sequences
From: https://leetcode.com/problems/repeated-dna-sequences/All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it
2015-07-17 18:14:46 370
原创 [leetcode] Product of Array Except Self
From : https://leetcode.com/problems/product-of-array-except-self/Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product o
2015-07-17 14:36:45 467
原创 [leetcode] Next Permutation
From : https://leetcode.com/problems/next-permutation/Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrang
2015-07-17 13:53:32 324
原创 [leetcode] Sort Colors
From : https://leetcode.com/problems/sort-colors/Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in th
2015-07-16 21:33:19 281
原创 [leetcode] Search a 2D Matrix
From : https://leetcode.com/problems/search-a-2d-matrix/Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in ea
2015-07-15 23:46:16 306
原创 [leetcode] Search for a Range
From : https://leetcode.com/problems/search-for-a-range/Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complex
2015-07-15 22:58:50 295
原创 [leetcode] Number of Digit One
From : https://leetcode.com/problems/number-of-digit-one/Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For exampl
2015-07-15 16:48:59 500
原创 [leetcode] Spiral Matrix
From : https://leetcode.com/problems/spiral-matrix/Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the follo
2015-07-15 15:51:42 293
原创 【leetcode】 Permutations II
From : https://leetcode.com/problems/permutations-ii/Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the
2015-07-15 14:56:58 476
原创 [leetcode] Lowest Common Ancestor of a Binary Tree
From : https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the
2015-07-14 16:42:29 296
原创 [leetcode] Lowest Common Ancestor of a Binary Search Tree
From : https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
2015-07-14 15:39:45 463
原创 [leetcode] Power of Two
From :https://leetcode.com/problems/power-of-two/Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding thi
2015-07-14 14:24:23 309
原创 [leetcode] Restore IP Addresses
From : https://leetcode.com/problems/restore-ip-addresses/Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given
2015-07-14 13:13:34 341
原创 [leetcode] Search in Rotated Sorted Array II
From : https://leetcode.com/problems/search-in-rotated-sorted-array-ii/Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time co
2015-07-14 10:13:46 319
原创 [leetcode] Search in Rotated Sorted Array
From : https://leetcode.com/problems/search-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6
2015-07-14 09:42:10 305
原创 [leetcode] Remove Duplicates from Sorted Array II
From : https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted
2015-07-13 19:25:25 272
原创 [leetcode] Remove Duplicates from Sorted List II
From : https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from th
2015-07-13 19:00:59 359
原创 [leetcode] Reverse Linked List II
From : https://leetcode.com/problems/reverse-linked-list-ii/Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 an
2015-07-13 17:56:11 302
原创 [leetcode] Path Sum II
From : https://leetcode.com/problems/path-sum-ii/Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below bin
2015-07-13 17:28:40 284
原创 【leetcode】Longest Palindromic Substring
From : https://leetcode.com/problems/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
2015-07-13 08:51:50 403
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人