原创 leetcode 219:Contains Duplicate II

題目: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in

原创 使用Solr作爲輔助工具,在Reuters-21578測試集上創建一個簡易的搜索引擎(一)

        使用Solr作爲輔助工具,在Reuters-21578測試集上創建一個簡易的搜索引擎(一)Solr安裝 一、下載所需要的工具、素材 下載Solr當前最新的solr-4.10.2,地址http://www.apache.or

原创 leetCode 6:ZigZag Conversion

leetCode 6:ZigZag Conversion 題目: The string “PAYPALISHIRING” is written in a zigzag pattern on a given

原创 leetcode 206:Reverse Linked List

題目: Reverse a singly linked list. 分析: 題目考察鏈表的反轉,在這裏主要是next指針的調整,利用指向前一個結點的指針before,指向後一個結點的指針followee,從而實現鏈表的反轉。

原创 leetcode -Maximum Depth of Binary Tree

question: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest

原创 k-means 聚類算法

聚類算法 一、聚類算法簡介: 1、什麼是聚類? 將物理或抽象對象的集合分組成爲有類似的對象組成的多個簇的過程被稱爲聚類。由聚類所生成的簇是一組數據對象的集合,這些對象與同一個簇中的對象彼此相似,與其它簇中的對象相異。在許多應用中,可以將一

原创 java I/O處理

【案例1】創建一個新文件 1 2 3 4 5 6 7 8 9 10 11 import java.io.*; class hello{     public static void main(String[] a

原创 leetcode-Remove Duplicates from Sorted List

problem: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,

原创 對分類算法-決策樹算法的學習(一)

一、概念: 1、什麼是分類?聚類又是什麼? (1)Classification (分類),對於一個 classifier ,通常需要你告訴它“這個東西被分爲某某類”這樣一些例子,理想情況下,一個 classifier 會從它得到的訓練集中

原创 leetcode :twoSum

problem: Given an array of integers, find two numbers such that they add up to a specific target number. The functio

原创 leetcode 217:Contains Duplicate

題目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any

原创 杭電acm1004

自己寫了代碼,但是總是時間受限,所以在網上尋求幫助,下面是從網上看到了不錯的代碼: #include <map> #include <iostream> #include <string> using namespace std; int

原创 leetcode 223:Rectangle Area

題目: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bott

原创 leetcode linked list cycle

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

原创 leetcode 226 :Invert Binary Tree

題目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9