原创 查找列表是否含有環(一)——Leetcode系列(九)

Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? My An

原创 使用插入排序算法對列表進行排序——Leetcode系列(五)

Sort a linked list using insertion sort. My Answer: <span style="font-size:14px;">/** * Definition for singly-linked l

原创 同一直線上最多的點的個數——Leetcode系列(三)

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Clarification: Cou

原创 使用迭代法對二叉樹進行前序遍歷——Leetcode系列(七)

Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3},

原创 msg郵件轉eml郵件

因爲msg格式的郵件只能由outlook客戶端打開,foxmail客戶端無法打開;而eml格式的郵件兩個客戶端都能打開。本文利用Aspose.Email.dll庫,將msg格式的郵件轉成eml格式的郵件。 using System; u

原创 使用快速排序算法對列表進行排序——Leetcode系列(四)

Sort a linked list in O(n log n) time using constant space complexity. My Answer: /** * Definition for singly-linked

原创 垃圾回收算法簡介——JVM讀書筆記

垃圾回收的過程主要包括兩部分:找出已死去的對象、移除已死去的對象。 確定哪些對象存活有兩種方式:引用計數算法、可達性分析算法。 方案一:引用計數算法 給對象中添加一個引用計數器,每當有一個地方引用它時,計數器值加1;當引用失效時,計數器

原创 Java內存區域——JVM讀書筆記

Java虛擬機運行時數據區 運行時數據區主要包括:方法區、堆、虛擬機棧、本地方法棧、程序計數器。 其中方法區和棧是線程共享的區域,另外三塊區域是每個線程私有的區域。各個數據區的功能簡單說明如下: 程序計數器:當前線程所執行的字節碼的行號指

原创 計算逆波蘭式——Leetcode系列(一)

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each opera

原创 使用迭代法對二叉樹進行後序遍歷——Leetcode系列(六)

Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3},

原创 Eclipse + Tomcat 配置

開發環境 Eclipse For Java EE(Kepler Release)Tomcat(7.0) 開發步驟 安裝Web工具 點擊Eclipse->Help->Install New Software..添加更新源:http://

原创 查找列表是否含有環(二)——Leetcode系列(十)

Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you so

原创 判斷字符串是否能分割成字典中的單詞(一)——Leetcode系列(十一)

Word Break Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separat

原创 樹狀形式打印二叉樹

樹狀結構打印二叉樹,難點在於確定節點之間的間隙。由於每個節點內容的長度不統一,在此處理方法是:選取每個最長的長度作爲標準,其他的節點用空格符補齊。 對一個高爲h的二叉樹,最底層(葉子節點),第一個節點距離起始輸出間隙爲2^0 —1,節點之

原创 列表重新排序——Leetcode系列(八)

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 witho