原创 HBase1.0.0的RPC機制分析與源碼解讀(一)

HBase的RPC機制,除了使用protocal buf的工具之外都是利用java的原生API進行構造,RPC機制的解讀包括客戶端和服務器端兩個部分,本文主要就服務器端的服務運行機制以及工作流程進行簡要分析.首先我們來分析一下一個典型的R

原创 HBase1.0.0源碼分析之Client啓動連接流程

我們知道在使用HBase的過程中首要的是和服務器端取得鏈接,那麼客戶端是如何去鏈接的,它是怎麼找到master和regionserver的? 參與該過程中的主要組件又有哪些?這些組件之間是如何協同工作的呢? 今天就讓我們來一起解析. HB

原创 [LeetCode]Unique Paths II

該題和之前的題目之間的區別就是某些單元是不可達的,這可以加上判斷語句即可 算法1:public class Solution { publi

原创 [LeetCode]Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to

原创 HBase1.0.0源碼分析之請求處理流程分析以Put操作爲例(一)

如下面的代碼所示,是HBase Put操作的簡單代碼實例,關於代碼中的Connection connection = ConnectionFactory.createConnection(conf),已近在前一篇博 HBase1.0.0源

原创 [LeetCode]Find Minimum in Rotated Sorted Array

題意:從一個平移過的數組中找到最小的元素思路1:最簡單的思路莫過於排序然後取第一個元素,複雜度O(N*log(N)) 代碼1: public cla

原创 [LeetCode]Combination Sum

題意:求一個數組中的組合爲某個target的所有子數組組合,要求不重複, 思路:先將數組排序,然後按深度遍歷的思想對i - > len -1的元素進

原创 [LeetCode]Plus One

</pre>簡單題不解釋, 維護一個進位即可<pre name="code" class="java">public class Solution { public int[] plusOne(int[] digits) {

原创 [LeetCode]First Missing Positive

題意:在亂序數組中找到第一個沒出現的正整數 思路1: 直接暴力解決,複雜度O(N*N) 代碼1: public int firstMissin

原创 [LeetCode]3Sum

題意: 找出一個數組內和爲0的三元組,元組不能重複 思路1:.直接暴力DFS,這樣會超時,不過先排序加上剪枝的花據說能夠AC 思路2:先排序O(N*log(N)),然後遍歷a 從0 到 nums.length - 2, 結下來的問題就簡化

原创 [LeetCode]Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image b

原创 [LeetCode]Sort Colors

Given an array with n objects colored red, white or blue, sort them so tha

原创 [LeetCode]Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top

原创 [LeetCode]Majority Element

題意: 找出一個數組中的主要元素,主要元素爲出現次數大於[n/2]的元, 當然最笨的方法就是暴力,沒式不知道時間行不行 思路1: 遍歷數組,統計每個元素出現的次數,用HashMap統計每個元素出現的次數 時間複雜度O(N),空間複雜度 O

原创 [LeetCode]Find Peak Element

A peak element is an element that is greater than its neighbors. Given an