- 博客(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 911
原创 机器学习实战—决策树(二)
#-*-coding:utf-8-*-import chch.set_ch()import matplotlib.pyplot as pltdecisionNode = dict(boxstyle = "sawtooth",fc="0.8")leafNode = dict(boxstyle="round4",fc = "0.8")arrow_args = dict(ar
2015-04-13 12:06:46 986
原创 机器学习实战——决策树
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 1007
原创 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 752
原创 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 502
原创 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 444
原创 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 595
原创 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 683
原创 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 531
原创 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 570
原创 Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total
2015-04-02 09:54:38 606
原创 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 508
原创 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 584
原创 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#includeusing name
2015-04-01 11:35:38 599
原创 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 511
原创 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 531
原创 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 536
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人