随笔分类 -  Algorithm

摘要:package Sort; import java.util.Arrays; public class MergeSort { public static void merge(int[] list, int low, int mid, int high) { int[] temp = new int[high - low + 1]; ... 阅读全文
posted @ 2016-05-12 14:48 finalboss1987 阅读(267) 评论(0) 推荐(0)
摘要:package Sort; import java.util.Arrays; public class QuickSort { public static void quicksort(int[] list, int left, int right) { if(left > right){ return; }... 阅读全文
posted @ 2016-05-11 15:58 finalboss1987 阅读(115) 评论(0) 推荐(0)
摘要:选择排序思想就是选出最小或最大的数与第一个数交换,然后在剩下的数列中重复完成该动作。 阅读全文
posted @ 2016-05-11 14:01 finalboss1987 阅读(119) 评论(0) 推荐(0)
摘要:package Sort; import java.util.Arrays; public class InsertionSort { public static int[] sort(int[] list) { for (int i = 1; i 0 && x < list[j - 1]) { list[j] = list[j ... 阅读全文
posted @ 2016-05-11 13:37 finalboss1987 阅读(176) 评论(0) 推荐(0)
摘要:冒泡排序思想就是将数列的相邻两个数比较,较大的数往后保存,小的数往前。 阅读全文
posted @ 2016-05-11 11:37 finalboss1987 阅读(145) 评论(0) 推荐(0)
摘要:package WebCrawler; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.Queue; public class Graph { private HashMap> adj; // 邻接表 private Arr... 阅读全文
posted @ 2016-04-26 16:23 finalboss1987 阅读(322) 评论(0) 推荐(0)
摘要:package DecisionTree; import java.io.*; import java.util.*; public class ID3 { //节点类 public class DTNode { private String attribute; private HashMap<S 阅读全文
posted @ 2016-03-10 15:42 finalboss1987 阅读(477) 评论(0) 推荐(0)
摘要:k近邻算法是机器学习算法中最简单的算法之一,工作原理是:存在一个样本数据集合,即训练样本集,并且样本集中的每个数据都存在标签,即我们知道样本集中每一数据和所属分类的对应关系。输入没有标签的新数据之后,将新数据的每个特征和样本集中数据对应的特征进行比较,然后算法提取样本集中特征最相似数据的分类标签作为 阅读全文
posted @ 2016-03-03 10:00 finalboss1987 阅读(2366) 评论(0) 推荐(0)
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
posted @ 2015-12-26 21:05 finalboss1987 阅读(116) 评论(0) 推荐(0)
摘要:题目:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 s... 阅读全文
posted @ 2015-12-26 21:04 finalboss1987 阅读(119) 评论(0) 推荐(0)