自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 资源 (18)
  • 收藏
  • 关注

原创 Longest Palindromic Substring 最长回文串 python实现

一、  题目:输入字符串s,输出该字符串中包含的最长回文串。回文串,指的是正着看和倒着看都一样的字符串,例如’abdba’。二、几种解法1、      Brute-force解法(1)、思路:第一步,通过两层for循环得到输入字符串s的所有可能子串。第二步,逐个判断子串是否为回文串。若当前子串为回文串且长度大于之前得到的回文串,更新当前最长回文串。(2)、代码'

2018-01-06 16:35:48 4222 4

原创 java实现二叉树的创建及遍历

java实现二叉树的创建及遍历巩固一下二叉树基础知识package Tree;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;import java.util.Queue;import java.util.Stack;/** * * @author don * */publ

2016-01-05 21:17:25 444

原创 决策树模型入门学习

一:基本介绍 决策树模型就是为了求出一系列规则,按照规则划分数据,得到预测结果。可以把决策树看做有决策块和终止块组成,如下图: 上图图是女孩对是否与男生见面的决策过程,典型的分类树决策。相当于通过年龄、长相、收入和是否公务员对将男人分为两个类别:见和不见。假设这个女孩对男人的要求是:30岁以下、长相中等以上并且是高收入者或中等以上收入的公务员,那么这个可以用下图表示女孩的决策逻辑。 二:

2015-08-09 23:33:55 13201

原创 机器学习入门-问题处理流程

首先我们会得到相应背景下的问题,还有一些历史数据,接下来要思考的就是怎样利用数据学习算法解决问题?          目前了解到的问题解决过程,首先是数据探索,只有充分了解数据才能开展接下来的工作;结合业务背景和对数据的了解,我们需要对数据进行一些预处理;我们需要根据问题和我们设定的解决办法进行数据集的分割,得到训练数据和测试数据;利用数据学习算法我们可以得到问题的可能答案。       

2015-08-06 13:56:51 374

原创 机器学习入门-各种名称

要开始下面的学习,首先必须了解机器学习的分类,根据不同的分类标准,我们会有不同的分类结果,这些名称在以后的机器学习中我们总会遇到,不同类型的问题我们会有不同的解决办法。       一、根据输出空间划分:               1、分类问题:包括二分类问题,多分类问题。比如要求我们根据用户过去一段时间在淘宝上的历史行为记录,预测用户接下来是否会都买,结果要么是"买",要么"不买",二

2015-08-06 01:24:12 444

原创 机器学习入门-了解相关概念

按照了解一个新事物的步骤,学习机器学习时我们首先提出的问题是,什么是机器学习?机器学习可以干什么?我们为什么需要机器学习?      从人类诞生以来便一直在学习,学习行走,钻木取火。。。自我们呱呱坠地便开始了一生的学习,人类学习的过程是先观察后学习最后获得相关技能,相对的简单的技能可以通过短时间内学习得到,但是越复杂的技能可能需要的时间太过漫长。但是我们需要对复杂领域的学习来解决面临的问题,人

2015-08-06 00:55:03 489

原创 快速排序

今天学习了快速排序算法,实现了基本快速排序和三向切分快速排序,其中三向切分对于有大量重复数据的情况有很好的作用。package Code;import java.util.Random;public class QuickSort { public static void sort(int[] a){ for(int i=0,len=a.length;i<len;i++){

2015-08-05 20:34:09 318

原创 leetcode 190:Reverse Bits

题目: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010

2015-07-09 20:33:57 297

原创 leetcode 191:Number of 1 Bits

题目: Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 00000000

2015-07-09 20:27:58 316

原创 leetcode 70: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? 分析: 考察动态规划,用户上楼梯,每次可迈1步或2步,现

2015-07-09 01:37:17 325

原创 leetcode 198: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 h

2015-07-09 01:24:41 345

原创 leetcode 58: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 defin

2015-07-09 01:09:57 310

原创 leetcode 202:Happy number

题目: Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares

2015-07-08 13:16:36 386

原创 leetcode 66:plus one

题目: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list. 分析: 本题是将整数n的每一位存储在数组中

2015-07-08 13:07:01 295

原创 leetcode 225:Implement Stack using Queues

题目: Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return

2015-07-08 12:56:37 253

原创 leetcode 203:Remove Linked List Elements

题目: Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5 分析: 本题考查链表的操作,要求删除列表元素,只要将指向被删除元素的

2015-07-07 15:20:19 348

原创 leetcode 204:Count Primes

题目: Description:Count the number of prime numbers less than a non-negative number, n. 分析: 本题是要统计0~n的素数个数,这个要根据hint中的提示,利用埃拉托色尼筛法,需要去除0~开根号n的倍数,比如从2开始,去除2*2,2*3,…;最后剩下的就是0~n的素数。 代码:public class coun

2015-07-07 15:11:27 224

原创 leetcode 205:Isomorphic Strings

题目: Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another

2015-07-07 15:01:13 228

原创 leetcode 231:Power of Two

题目: Given an integer, write a function to determine if it is a power of two. 分析: 本题需要判断一个数是否为2的n次方,通过观察2的n次方的十进制和二进制,可以发现一些规律: 1 2 4 8 16   ….1 10 100 1000 10

2015-07-06 17:07:36 232

原创 leetcode 155: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() -- G

2015-07-06 16:55:55 247

原创 leetcode 206:Reverse Linked List

题目: Reverse a singly linked list. 分析: 题目考察链表的反转,在这里主要是next指针的调整,利用指向前一个结点的指针before,指向后一个结点的指针followee,从而实现链表的反转。 代码:package Code;public class LinkedList { /** * 链表结点类 * @author Don

2015-07-06 16:48:25 233

原创 leetcode 217:Contains Duplicate

题目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every elemen

2015-07-05 12:13:17 238

原创 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 the array such that nums[i] = nums[j] and the difference between i and j is at most k.

2015-07-05 11:12:54 358

原创 leetcode 223:Rectangle Area

题目: Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Rectangle Area Assume tha

2015-07-05 10:50:39 426

原创 leetcode 226 :Invert Binary Tree

题目: Invert a binary tree.4 / \ 2 7 / \ / \ 1 3 6 9to4 / \ 7 2 / \ / \ 9 6 3 1 分析: 本题是对二叉树的操作,题目要求将二叉树反转,可以有递归和非递归两种实现方法,在编写测试用例的时候,需要构建二叉树和遍历二叉树,所以在代码中一致列

2015-07-04 11:41:07 521

原创 leetcode 228:Summary Ranges

leetcode 228:Summary Ranges题目: Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”]. 分析: 这道题是对数组的操作,给定一

2015-07-04 11:29:19 292

原创 leetCode 6:ZigZag Conversion

leetCode 6:ZigZag Conversion题目: The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legib

2015-07-04 10:18:52 354

转载 java I/O处理

【案例1】创建一个新文件1234567891011import java.io.*;class hello{    public static void main(String[] args) {        File f=new File("D:\\hello.txt");        t

2015-04-14 10:42:22 316

原创 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 path from the root node down to the farthest leaf node.Hide Tags T

2015-02-10 23:48:46 335

原创 leetcode-Remove Duplicates from Sorted List

problem:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.Hid

2015-02-04 00:27:01 224

原创 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 space?Hide Tags Linked List Two Pointers

2015-02-03 23:58:42 219

原创 leetcode :twoSum

problem:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to t

2015-02-03 19:07:03 258

原创 使用Solr作为辅助工具,在Reuters-21578测试集上创建一个简易的搜索引擎(一)

solr安装

2014-12-25 13:03:17 707

原创 k-means 聚类算法

聚类算法一、聚类算法简介:1、什么是聚类?将物理或抽象对象的集合分组成为有类似的对象组成的多个簇的过程被称为聚类。由聚类所生成的簇是一组数据对象的集合,这些对象与同一个簇中的对象彼此相似,与其它簇中的对象相异。在许多应用中,可以将一个簇中的数据对象作为一个整体来对待。2.分类:大体上,主要的聚类技术可以划分为如下几类:A.划分方法  给定一个个对象或元组的数据库,一个划

2014-12-20 14:45:54 1780

转载 杭电acm1004

自己写了代码,但是总是时间受限,所以在网上寻求帮助,下面是从网上看到了不错的代码:#include #include #include using namespace std;int main(){int n;string str;map strMap;while(cin>>n && n){strMap.clear();for(int i = 0

2014-12-20 14:39:40 325

原创 对分类算法-决策树算法的学习(一)

一、概念:1、什么是分类?聚类又是什么?(1)Classification (分类),对于一个 classifier ,通常需要你告诉它“这个东西被分为某某类”这样一些例子,理想情况下,一个 classifier 会从它得到的训练集中进行“学习”,从而具备对未知数据进行分类的能力,这种提供训练数据的过程通常叫做 supervised learning (监督学习),(2)而Cluste

2014-12-19 20:47:40 544

python 人脸识别

利用PCA进行人脸识别,python代码,网络上大多见到的是matlab实现,对matlab不熟的可以看看这篇代码加讲解的文档

2015-12-18

java实现朴素贝叶斯文本分类

利用java语言实现朴素贝叶斯,解决文本分类问题,可以看一看。

2015-09-12

自然语言处理综述中文版

自然语言处理综述中文版,可以帮助了解自然语言处理方面的知识,可以花时间看一看。

2015-09-12

文本分类 java代码

中文文本分类代码,java实现,对这方面感兴趣的可以看一看。

2015-08-24

矩阵论清华大学方保镕 教材以及课后习题答案

矩阵论清华大学方保镕教材以及课后习题答案,机器学习,推荐算法涉及到的矩阵知识都可以翻翻。

2015-08-21

推荐系统实践 项亮

推荐系统在当今大数据时代越来越得到普及,本书作为一本指导初学者入门推荐算法实现的好书值得阅读。

2015-08-21

最优化理论与算法 陈宝林教授

最优化理论与算法,陈宝林教授,很好的最优化方面的书籍。

2015-05-18

最优化理论与方法

最优化理论与方法,袁亚湘,最优化思想在算法中是很重要的!

2015-05-18

Online Learning 算法简介

Online Learning 算法简介,希望可以对理解Online Learning 算法有所帮助!

2015-05-18

reuters-21758java处理代码

reuters-21758源文档格式不能直接使用,在这里提供了java处理的程序。

2014-12-25

reuters-21578 转换txt格式Python代码

reuters-21578源文件格式是不能直接拿来用的,这里提供了python代码将文档转换成txt格式

2014-12-25

reuters-21578

reuters-21578,这是一个英文的语料库,可以用于进行文本的分类与聚类。是文本分类领域共用的一个语料库。

2014-12-25

基于图的推荐算法 c,c++ 实现 代码 项亮 随机游走

基于图的推荐算法 c,c++ 实现 代码 项亮 随机游走

2014-12-05

推荐系统实践扫描版,内有代码,适合帮助程序实现算法

推荐系统实践扫描版,内有代码,帮助加深对推荐系统的学习,书中附有实例和算法实现,挺不错!

2014-12-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除