原创 ScrollView與RecyclerView衝突及異常情況處理

昨天再寫項目的時候,有一個佈局需要ScrollView嵌套RecyclerView,效果展示的時候RecyclerView的滑動會出現卡頓的樣子,ScrollView也滑動不流暢。產生的原因是ScrollView與RecyclerView

原创 LeetCode----- 21.Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes o

原创 LeetCode----- 27.Remove Element

Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate

原创 Java-----Semaphore信號量

一.Semaphore介紹 Semaphore:字面意思是信號量,主要用來控制同時訪問某個特定資源的操作數量或者某個操作的數量。 二.Semaphore常用操作函數 (1).構造函數: public Semaphore(int perm

原创 Java----- ArrayList構造、add、remove、clear方法實現原理源碼分析

一.ArrayList內部的實現方式 ArrayList內部是通過Object[]實現的。 二.源碼分析: (1).構造方法 public ArrayList() { array = EmptyArray.OBJ

原创 劍指offer-----重構二叉樹

/** * 劍指offer面試題6:重構二叉樹 * * 題目:輸入某二叉樹的前序遍歷和中序遍歷的結果,請重建出該二叉樹。假設輸入的前序遍歷和中序遍歷結果中都不含重複的數字。 * * 思路:根據前序遍歷序列的第一個數字創建根

原创 AdaBoost算法原理詳解

Boosting提升算法    Boosting算法是將“弱學習算法”提升爲“強學習算法”的過程,最具有代表性的是AdaBoost算法。Boosting提升算法思想:對於一個複雜任務來說,將多個專家的判斷進行適當的綜合所得出的判斷,要比其

原创 劍指offer-----斐波那契數列

/** * 劍指offer面試題9:斐波那契數列 * * 題目:寫入一個函數,輸入n,求斐波那契數列的第n項。 * * 考察:遞歸,循環,時間複雜度的理解 * * 推薦方式:用循環來解 * * 應用1:一隻青蛙

原创 LeetCode----- 35.Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it w

原创 劍指offer-----數值的整數次方

/** * 劍指offer面試題11:數值的整數次方 * * 題目:實現函數double power(double base,int exponent),求base的exponent次方。 * 不得使用庫函數,同時不需要考慮大

原创 劍指offer-----用兩個棧實現隊列

import java.util.Stack; /** * 劍指offer面試題7:用兩個棧實現隊列 * * 題目:用兩個棧實現一個隊列。完成隊列的Push和Pop操作。隊列的元素爲int類型。 * * 考查:對棧和隊列

原创 Android-----Fragment動態添加和替換

/** * 添加一個Fragment * @param containerId * @param fragment * @param tag */ protected vo

原创 機器學習-----K-Means

聚類的定義     將物理或抽象對象的集合分成由類似的對象組成的多個類的過程被稱爲聚類。由聚類所生成的簇是一組數據對象的集合,這些對象與同一個簇中的對象彼此相似,與其他簇中的對象相異。“物以類聚,人以羣分”,在自然科學和社會科學中,存在着

原创 劍指offer-----旋轉數組的最小數字

/** * 劍指offer面試題8:旋轉數組的最小數字 * * 題目:把一個數組最開始的若干個元素搬到數組的末尾,我們稱之爲數組的旋轉。輸入一個遞增排序的數組的一個旋轉, * 輸出旋轉數組的最小元素。例如數組{3,4,5,1,

原创 LeetCode----- 40.Combination Sum II

Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the cand