自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(421)
  • 资源 (7)
  • 收藏
  • 关注

原创 (转) External Sort

我觉得这个是讲External Sort的文章中,最容易看懂的文章http://faculty.simpson.edu/lydia.sinapova/www/cmsc250/LN250_Weiss/L17-ExternalSortEX1.htmCC as below:CmSc 250 Intro to AlgorithmsEx

2015-12-15 04:32:25 2813

原创 Java菜鸟入门(21) Merge K sorted List

假设输入是K个iterator, 如何来merge这K个iterator of Integer,使得输出是 List?1. 类似Merge K sorted List普通题的思路,使用PriorityQueue(or, Heap2. 使用一个wrapper来把current Integer value和它的相关的Iterator给捆绑打包。这样做的原因是,每次使用了iterator.nex

2015-12-14 18:00:35 1284

原创 Java菜鸟入门(20) Producer Consumer经典代码

来自oracle官网 https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html class BoundedBuffer { final Lock lock = new ReentrantLock(); final Condition notFull = lock.newC

2015-12-13 07:32:23 1620

原创 LeeCode(149) 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.分析如下:思路比较直接,对其中某一个点i, 找到点i和剩下的所有n - 1个点构成的斜率。如果在这n - 1个斜率中,能够找到这样一个值,这个出现次数最多,那么就可以认为,

2015-12-11 12:19:51 874

原创 LeetCode(269) Alien Dictionary (Java)

题目如下:There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words from the dictionary, where words are sorted lexicog

2015-11-25 18:58:18 4400

原创 JAVA菜鸟入门 (19) inner calss: static v.s. non-static在main中被实例化时的区别

1. 首先, class中的class粗略地分成2类, static v.s non-static."Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are simply called static nested clas

2015-10-29 16:53:26 1144

原创 LintCode Number of Airplanes in the Sky(Java)

题目如下:Given an interval list which are flying and landing time of the flight. How many airplanes are on the sky at most?Have you met this question in a real interview? YesExampleFor interval li

2015-10-12 02:07:43 2306

原创 How to first sort by one attribute, if equal, then sort by another attribute.

这个小代码来demo一下,如何来按照两个字段进行sort。 场景1有一个list of  classes,每个class中的attribute 1是String name, attribute 2是  Int age。现在假设需求是先按照name 字母顺序升序排序,加入两个人同名同姓,再按照age升序排序。 在这样的场景下,就需要使用comparator去对2个字段进行排序。场

2015-09-28 13:12:21 616

原创 Trie相关的一些题目[draft]

关于trie的定义和图形请先看这里的简短描述。下面列出它相关的一些基本操作。1. build a trie这是基本操作,建立一个trie,add a word, search for that word, 正好有道题目在Leetcode上.class TrieNode { // Initialize your data structure here. char elem

2015-09-27 15:15:38 1021

原创 LeetCode 分类整理(01) DFS 草稿

subset// solution 2 version B// a slightly different version from version A.// make a slight optimization while doing right shift.public class Solution {   public List> subsets

2015-08-31 15:46:44 995

原创 LeetCode(078) Subsets (Java)

题目如下:Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets. For exampl

2015-07-02 13:54:17 1015

原创 JAVA菜鸟入门(18) Set的Iterator

1. 使用iterator遍历Set中元素public class SetIteratorDemo { public static void main(String[] args) { HashSet objectSet = new HashSet(); objectSet.add("white"); objectSet.add("white"); objectSet.add

2015-06-23 15:03:43 3546

原创 JAVA菜鸟入门(17) 有排序的TreeSet和无排序的HashSet, LinkedHashSet

General-Purpose Set ImplementationsThere are three general-purpose Set implementations — HashSet, TreeSet, and LinkedHashSet. Which of these three to use is generally straightforward.HashSet i

2015-06-22 01:51:42 753

原创 JAVA菜鸟入门(16) callback函数

Java中的callback函数, template:interface CallBack { void methodToCallBack();}class CallBackImpl implements CallBack { public void methodToCallBack() { System.out.println("I've been ca

2015-05-21 01:24:56 1047

原创 SumOfNestedList

get sum of NestedList是一道非常有名非常高频的的电面题/** * Given a nested list of integers, returns the sum of all integers in the list weighted by their depth * For example, given the list {{1,1},2,{1,1}} the

2015-05-18 15:30:54 998

原创 JAVA菜鸟入门(15) static method/ field与normal method/field的相互调用关系

1.   normal method uses static field => finepublic class StaticFieldDemo { public static int staticVar; public int instanceVar; /* * test1 normal method uses static field */ public void No

2015-05-18 14:44:43 1666

原创 JAVA菜鸟入门(14) Anonymous Class 和 final variable

Anonymous Class在使用外面的local variable的时候,要declare为final,否则会有compiler error.import javax.swing.JButton;import javax.swing.JTextField;public class HelloWorldAnonymousClasses { public HelloWorldAno

2015-05-09 06:51:07 1071

原创 JAVA菜鸟入门(13) outer class与inner class的之间能互相使用field或者method吗?

Nested classes are divided into two categories: static and non-static. 1. Nested classes that are declared static are called static nested classes. 2. Non-static nested classes are called inner cl

2015-05-01 04:44:46 2712

原创 JAVA菜鸟入门(12) reference variable是气球的线 +JVM中怎么实现

1 如果variable是primitive,那就拷贝原来变量的值到新变量。2 如果variable是object referece, 那就拷贝原来reference的值到新的变量,所以就有2个reference varibal指向了相同的object.eg. // Before the method callObject x = null;// Start of method c

2015-04-28 23:42:42 4607

原创 JAVA菜鸟入门(11) 基本类型

一. 基本类型Java 基础数据类型byte (number, 1 byte)short (number, 2 bytes)int (number, 4 bytes)long (number, 8 bytes)float (float number, 4 bytes)double (float number, 8 bytes)char (a characte

2015-04-26 01:11:03 1109

原创 JAVA菜鸟入门(10) 类初始化, 字符串比较equals() v.s. ==, Casting, ArrayList注意

一. 类的初始化第一种更推荐, 可以简化或者省略构造函数,代码简洁第二种 public class WeatherForecast{private String skies = "";private int high = 0;private int low = 0;public void setSkies(

2015-04-26 00:50:09 826

原创 JAVA菜鸟入门(9) Java打印一维数组,二维数组

一 打印list中的元素0 JAVA风格的最简做法import java.util.List;...List l = new ArrayList(3);System.out.println(l);1 JAVA风格的做法import java.util.Arrays;import java.util.List;import java.util.ArrayList;...

2015-04-26 00:39:24 15926 1

原创 JAVA菜鸟入门(8) Java的Final关键字

java final 和C++的const功能类似,用来表达常量,还能用在class或者method上,提供不同的用法。1. Java Final Variable Once a final variable has been assigned, it always contains the same value.但是 static final和private final是

2015-04-26 00:32:37 1200

原创 LeetCode(119) Pascal's Triangle II (Java)

题目如下:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?我的代码:

2015-04-20 10:01:28 2575

原创 LeetCode(188) Best Time to Buy and Sell Stock IV (Java)

题目如下:Best Time to Buy and Sell Stock Total Accepted: 43912 Total Submissions: 135635 My Submissions Question Solution Say you have an array for which the ith element is the price of a given stock

2015-04-19 15:45:27 7347

原创 LeetCode(123) Best Time to Buy and Sell Stock III (Java)

题目如下:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:Y

2015-04-19 13:20:26 1496

原创 LeetCode(122) Best Time to Buy and Sell Stock II (Java)

题目如下:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie,

2015-04-19 13:18:34 1507

原创 LeetCode(121) Best Time to Buy and Sell Stock (Java)

题目如下:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the

2015-04-19 13:15:43 1779

原创 LeetCode(045) Jump Game II (Java)

题目如下:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your

2015-04-13 15:00:17 1303

原创 LeetCode(055) Jump Game (Java)

题目如下:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Dete

2015-04-13 13:43:48 555

原创 LeetCode(080) Remove Duplicates from Sorted Array II (Java)

题目如下:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now

2015-04-13 13:18:27 530

原创 LeetCode(074) Search a 2D Matrix (Java)

题目如下:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of

2015-04-13 12:37:58 1159

原创 LeetCode(034) Search For a Range (Java)

题目如下:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not

2015-04-13 10:44:31 1041

原创 LeetCode(048) Rotate Image

题目如下:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?分析如下:首先沿着对角线(左上->右下)方向翻折,然后沿着中轴方向翻折。

2015-04-13 04:06:41 484

原创 LeetCode(035) Search Insert Position (Java)

题目如下:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the

2015-04-13 01:57:35 580

原创 LeetCode(073) Set Matrix Zeroes (Java)

题目如下:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably

2015-04-13 01:26:49 654

原创 LeetCode(118) Pascal's Triangle (Java)

题目如下:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[     [1],    [1,1],   [1,2,1],  [1,3,3,1], [1,4,6,4,1]]我的代码:

2015-04-12 15:48:08 1735

原创 LeetCode(088) Merge Sorted Array(Java)

题目如下:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional element

2015-04-12 14:25:10 719

原创 LeetCode(001) Two Sum (Java)

题目如下: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 the targ

2015-04-12 07:12:48 720

原创 LeetCode(026) Remove Duplicates from Sorted Array (Java)

题目如下:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in pla

2015-04-12 03:13:57 618

数据挖掘--概念.模型.方法和算法

本书全面讲述了数据挖掘的概念、模型、方法和算法。本书共包括13章和2个附录,全面、详细地讲述了从数据挖掘的基本概念到数据挖掘的整个过程,以及数据挖掘工具及其典型应用领域.

2009-09-20

机器学习 Tom Mitchell 中文版

书中主要涵盖了目前机器学习中各种最实用的理论和算法,包括概念学习、决策树、神经网络、贝叶斯学习、基于实例的学习、遗传算法、规则学习、基于解释的学习和增强学习等。对每一个主题,作者不仅进行了十分详尽和直观的解释,还给出了实用的算法流程。本书被卡内基梅隆等许多大学作为机器学习课程的教材。机器学习这门学科研究的是能通过经验自动改进的计算机算法,其应用从数据挖掘程序到信息过滤系统,再到自动机工具,已经非常丰富。机器学习从很多学科吸收了成果和概念,包括人工智能、概论论与数理统计、哲学、信息论、生物学、认知科学和控制论等,并以此来理解问题的背景、算法和算法中的隐含假定。

2009-09-20

机器学习英文版Machine Learning(Mitchell)(下)

本书展示了机器学习中核心的算法和理论,并阐明了算法的运行过程。本书综合了许多的研究成果,例如统计学、人工智能、哲学、信息论、生物学、认知科学、计算复杂性和控制论等,并以此来理解问题的背景、算法和其中的隐含假定

2009-09-14

机器学习英文版Machine Learning(Mitchell)(中)

本书展示了机器学习中核心的算法和理论,并阐明了算法的运行过程。本书综合了许多的研究成果,例如统计学、人工智能、哲学、信息论、生物学、认知科学、计算复杂性和控制论等,并以此来理解问题的背景、算法和其中的隐含假定。

2009-09-14

The C Programming Language 2nd Ed

C的入门经典,得到众多程序员的推荐。作者是Brian Wkernighan和Dennis M.Ritchie

2009-04-25

旅馆管理系统C#单机版

这是一本书上的旅馆管理系统的源代码,有数据库和详细的系统移植文件介绍。

2009-04-25

MLO-My Life Organized

一款国外的时间管理软件,进行个人管理时很实用,但不是源代码,程序员们莫打偶

2009-04-22

空空如也

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

TA关注的人

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