原创 (Leetcode)Reverse Words in a String

Reverse Words in a String 題目如下: Given an input string, reverse the string word by word. For example, Given s = "the sky

原创 (leetcode)Sort List

題目描述: Sort a linked list in O(n log n) time using constant space complexity 題目分析: 看其時間複雜度,想到與數組排序相關的一些排序算法,滿足這個複雜度的基本算法

原创 (leetcode)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

原创 (leetcode )Binary Tree Postorder Traversal

  問題描述: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2

原创 (leetcode)Linked List Cycle

題目描述: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?

原创 (leetcode)Max Points on a Line

Max Points on a Line 題目描述:  Given n points on a 2D plane, find the maximum number of points that lie on the same str

原创 (leetcode)Binary Tree Preorder Traversal

Binary Tree Preorder Traversal 題目描述: Given a binary tree, return the preorder traversal of its nodes' values. For examp

原创 Facade(外觀模式)

Façade模式的主要思想爲子系統中的一組接口提供一個一致的界面,這個接口使得這一子系統更加容易使用。 應用場景 引入Facade將這個子系統與客戶以及其他的子系統分離,可以提高子系統的獨立性和可移植性。當你需要構建一個層次結構的子系統時

原创 Java容器基本要點

Java容器基本要點 可將java容器類庫劃分爲兩個不同的概念: 1)Collection:一個獨立元素的序列,這些元素都服從一條或多條規則。List按照插入順序保存元素,set不插入重複元素。Queue按照隊列規則確定對象產生順序。 2

原创 (leetcode)Insertion Sort List

Insertion Sort List 題目描述: Sort a linked list using insertion sort. 題目分析: 這是利用插入法對鏈表排序,思路比較簡單。直接上代碼。 public ListNode in

原创 java 堆和棧

先了解具體的概念: JAVA的JVM的內存可分爲3個區:堆(heap)、棧(stack)和方法區(method)堆區:1.存儲的全部是對象,每個對象都包含一個與之對應的class的信息。(class的目的是得到操作指令)。 2.jvm只有

原创 (leetcode)Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation 題目描述: Evaluate the value of an arithmetic expression in Reverse Polish Notation.   Val

原创 Collection 和 Collections的區別

Collection是集合類的上級接口,繼承與他的接口主要有Set 和List,提供對數據的存儲操作。 Collections是針對集合類的一個幫助類,他提供一系列靜態方法實現對各種集合的搜索排序線程安全化等操作,主要是提供方法。 1、j

原创 java 訪問權限

java 訪問權限 1 成員訪問控制權限 public、protected和private這幾個java訪問控制權限修飾詞在使用時,是置於類中每個成員的定義之前的——無論它是一個域或是方法。每個訪問權限修飾詞僅僅控制它所修飾的特定定義的訪

原创 Decorator(裝飾模式)

Decorator模式的主要思想是爲一個對象已有的子類添加一些額外的職責。與生成子類相比,它更具有靈活性。 應用場景 該模式的使用場景,主要是有的時候我們不願意定義邏輯上新的子類,因爲沒有新的邏輯含義上的子類概念,而只是想爲一個已存在的子