原创 bootstrps 、bagging與 boosting

轉自:http://blog.sina.com.cn/s/blog_5dd2e9270100c8ko.html bootstrps bagging boosting這幾個概念經常用到,現仔細學習了一下: 他們都屬於集成學習方法,

原创 Morris Traversal - 不需遞歸和棧中序遍歷二叉樹

Morris Traversal的目的是在不適用遞歸和棧的情況下,在相同時間內得到二叉樹中序遍歷結果,空間複雜度爲O(1) 基本思想是線索二叉樹:首先建立中序遍歷的後向鏈接指針,然後通過指針進行中序遍歷,遍歷後再將二叉樹還原。 1. I

原创 leetcode-Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all

原创 Google中國2015校園招聘筆試Round D APAC Test Problem B. GBus count

Problem There exists a straight line along which cities are built. Each city is given a number starting from 1. So if t

原创 Google Code Jam 2014-Qualification Round-Problem C. Minesweeper Master

Problem Minesweeper is a computer game that became popular in the 1980s, and is still included in some versions of the 

原创 leetcode-Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 題意:給出平面上若干點的(x,y)

原创 leetcode-Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'.

原创 leetcode-LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:

原创 leetcode-Simplify Path

Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/..

原创 STL---set基本使用--取集合的交、並、差、對稱差

轉自:http://blog.sina.com.cn/s/blog_4c98b9600100az2v.html set是集合,其底層數據結構是紅黑樹,STL中set、map均採用紅黑樹結構作爲底層支持,紅黑樹與AVL樹類似,是一種平

原创 leetcode-Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the

原创 leetcode-Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a

原创 leetcode-Largest Rectangle in Histogram

Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area

原创 如何選擇機器學習分類器?

你知道如何爲你的分類問題選擇合適的機器學習算法嗎?當然,如果你真正關心準確率,那麼最佳方法是測試各種不同的算法(同時還要確保對每個算法測試不同參數),然後通過交叉驗證選擇最好的一個。但是,如果你只是爲你的問題尋找一個“足夠好”的算法,或者

原创 字符串匹配的KMP算法

字符串匹配是計算機的基本任務之一。 舉例來說,有一個字符串"BBC ABCDAB ABCDABCDABDE",我想知道,裏面是否包含另一個字符串"ABCDABD"? 許多算法可以完成這個任務,Knuth-Morris-Pratt