- 博客(17)
- 资源 (1)
- 收藏
- 关注
原创 机器学习实战——朴素贝叶斯
from numpy import * # 创建一个实验样本 def loadDataSet(): postingList = [['my','dog','has','flea','problems','help','please'], ['maybe','not','take','him','to','dog','park','stupid'
2015-04-15 18:24:14
947
原创 机器学习实战—决策树(二)
#-*-coding:utf-8-*- import ch ch.set_ch() import matplotlib.pyplot as plt decisionNode = dict(boxstyle = "sawtooth",fc="0.8") leafNode = dict(boxstyle="round4",fc = "0.8") arrow_args = dict(ar
2015-04-13 12:06:46
1034
原创 机器学习实战——决策树
from math import log #以决策为标准计算信息熵 def calcShannonEnt(dataSet): numEntries = len(dataSet) labelCounts = {} for featVec in dataSet: currentLabel = featVec[-1] if cu
2015-04-09 20:50:22
1047
原创 Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1
2015-04-06 13:57:20
784
原创 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 of largest rectangle in the histogram. Above is a histogram where width of ea
2015-04-02 20:40:20
535
原创 Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1],
2015-04-02 19:53:00
484
原创 Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2015-04-02 19:21:16
621
原创 Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all vali
2015-04-02 19:04:44
714
原创 Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cove
2015-04-02 13:39:56
560
原创 Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()",
2015-04-02 11:35:28
600
原创 Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total
2015-04-02 09:54:38
633
原创 House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2015-04-01 22:47:47
541
原创 Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input
2015-04-01 13:49:44
611
原创 Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? #include #include using name
2015-04-01 11:35:38
633
原创 Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is def
2015-04-01 11:09:56
538
原创 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()
2015-04-01 10:35:11
562
原创 Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word:
2015-04-01 10:13:20
560
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人