自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(93)
  • 资源 (2)
  • 收藏
  • 关注

原创 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?Note: Given n will be a positive inte

2017-06-02 21:49:39 347

原创 leetcode 582. Kill Process

Given n processes, each process has a unique PID (process id) and its PPID (parent process id).Each process only has one parent process, but may have one or more children processes. This is just like a

2017-06-01 20:48:26 901

原创 leetcode 501. Find Mode in Binary Search Tree

Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node contains onl

2017-06-01 19:15:44 358

原创 leetcode 450. Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be divided into t

2017-05-31 23:21:37 327

原创 leetcode 230. Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ? k ? BST's total elements.需要对树进行中序遍历,只是在中的时候做一些处理。public clas

2017-05-31 21:55:26 298

原创 leetcode 124. Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path

2017-05-31 19:59:33 308

原创 leetcode 199. 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

2017-05-31 19:29:19 354

原创 leetcode 129. Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total sum of al

2017-05-31 17:32:54 350

原创 leetcode 117. Populating Next Right Pointers in Each Node II

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space.

2017-05-31 17:23:02 358

原创 leetcode 116. Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there is

2017-05-31 16:50:28 320

原创 leetcode 114. Flatten Binary Tree to Linked List

Total Accepted: 123537Total Submissions: 357891Difficulty: MediumContributor: LeetCodeGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5

2017-05-31 16:33:10 343

原创 leetcode 105&106

105. Construct Binary Tree from Preorder and Inorder Traversal106. Construct Binary Tree from Inorder and Postorder TraversalNote:You may assume that duplicates do not exist in the tree.将手动解法规则化,主要是

2017-05-26 19:47:26 1036

原创 leetcode 99. Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devise a consta

2017-05-26 15:19:52 428

原创 leetcode 98. Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.The right

2017-05-26 10:57:51 369

原创 leetcode 95&96. Unique Binary Search Trees

96. Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3

2017-05-25 23:13:36 554

原创 leetcode 508. Most Frequent Subtree Sum

Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (includin

2017-05-25 19:43:24 358

原创 leetcode 538. Convert BST to Greater Tree

Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.Example:I

2017-05-25 17:04:51 347

原创 leetcode 515. Find Largest Value in Each Tree Row

You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]这题其实就是个广度优先搜索,一般解法是用队列/** * Def

2017-05-25 16:01:42 562

原创 leetcode 513. Find Bottom Left Tree Value

Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2 3 / / \ 4 5 6

2017-05-25 15:37:14 464

原创 Java Queue 一些方法对比

主要是 add()&offer(), remove()&poll(), element&peek()的对比 见官方APIpublic interface Queue<E> extends Collection<E>A collection designed for holding elements prior to processing. Besides basic Collection

2017-05-22 15:02:50 973

原创 leetcode 235&236

235Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between

2017-05-19 16:11:56 2142

原创 leetcode 572. Subtree of Another Tree

Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node'

2017-05-19 14:44:02 545

原创 leetcode 563. Binary Tree Tilt

Given a binary tree, return the tilt of the whole tree.The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree nod

2017-05-19 11:11:41 417

原创 leetcode 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \ 2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]分析: 这题递归的解法要点是要记住到达父节点的路径之

2017-05-19 10:50:56 356

原创 leetcode 404. Sum of Left Leaves

Find the sum of all left leaves in a given binary tree.如果采用递归的解法,就需要判断前后两次迭代的关系。 如果树只有一个节点,需要判断其与父节点的关系,如果该节点是左孩子,就直接返回其值,如果是右孩子就返回0。如果还有孩子,就往下递归。 注意到这里有个与父节点关系,按照一般的递归是无法保持这个信息,同时为了递归的简便,不太方便在每次递归里还

2017-05-19 10:12:26 760

原创 Java String.split() 关于空值(empty results)

现象String testString1 = "1, 1, 0, 0, 0, 6.17, 3.50,,,,,,,,,,,,,1";String testString2 = "1, 1, 0, 0, 0, 6.17, 3.50,,,,,,,,,,,,,";采用默认的split方式testString.split(",");这两者的结果是不一致的,前者的长度是20,后者为7. 因为字符串中产生了空值。

2017-02-22 17:04:32 9561

原创 Spark word2vec使用

Spark 提供有两个包提供了word2vec, 分别是org.apache.spark.mllib.feature.{Word2Vec, Word2VecModel}org.apache.spark.ml.feature.Word2Vec本质没有太大的区别,只是两个包的作用对象不一样spark.mllib contains the original API built on top of RDDs.spark.ml provides higher-level API built on top

2016-12-08 20:23:27 15727

原创 ThinkPad 关掉触摸板

自从笔记本跑烧后,一直用台式,现在再用ThinkPad的笔记本经常碰到触摸板,很是麻烦,直接给其关掉,到用时再打开。如果是X系列或T系列的我们直接按快捷键Fn+F8打开或关闭触控板即可我是E系列,诶!F8上有个触摸板禁用图标,直接Fn+F8,over。

2016-11-24 20:17:00 3712

原创 Spark1.6.0 Hadoop2.6.0 单机win7下配置(Intellij IDEA)

1. 首先需要注意的Scala版本要与Spark相应版本对应 比如Spark1.6.0,官网上给出了依赖 Spark runs on Java 7+, Python 2.6+ and R 3.1+. For the Scala API, Spark 1.6.0 uses Scala 2.10. You will need to use a compatible Scala version (2.

2016-11-24 19:58:17 4780

原创 Co-training 初探快切入

先做个总结co-training方法是一类半监督方法,是一个框架,核心就是利用少量已标记样本,通过两个(或多个)模型去学习,对未标记样本进行标记,挑选most confidently的样本加入已标记样本阵营。目前主要存在两种方法:single-view 和 multi-view。最开始提出的是multi-view,就是对特征进行拆分,使用相同的模型,来保证模型间的

2016-11-22 11:30:21 9763 1

原创 Excel 数据统计小技巧

快速定位与选择快速定位快捷键:可以快速定位到表头表尾快速选择一列: 快速填充公式方法奇偶行提取奇数行: `=INDIRECT将两个或更多个单元格的文本合并到一个单元格合并同类项(去除重复项)数据并求和SUMIF相关性分析 =CORREL

2016-10-20 16:52:36 1926

原创 ubuntu 安装搜狗输入法(解决部分ubuntu安装完没有键盘选择栏)

问题描述安装了个ubuntu 14.04 发现顶部并没有出现键盘,没有中文输入 上图是解决后的情况,之前没有这个键盘,无法却换到中文。解决方法首先到搜狗下载对于的安装包http://pinyin.sogou.com/linux/?r=pinyin如果是14.04 LTS 版本只需双击下载的 deb 软件包,即可直接安装搜狗输入法。 否则按照http://pinyin.sogou.com/

2016-08-23 19:13:45 10779 2

原创 Java 带index信息排序(包含集合框架的使用)

在进行排序的时候,我们一般得到的是排序后的结果。但是我们有时候不仅需要排序完的结果,还需要排序后对应原来序列的索引。毕图matlab中[result, index] = sort(a)result是排序后的结果,index为排序后对应得顺序索引 比如数组a = [1, 6, 3, 4],排序后result=[1, 3, 4, 6], index = [1, 3, 4, 2],即位置信息

2016-07-25 13:35:08 3389

转载 在Java中如何遍历Map对象

在Java中如何遍历Map对象 在Java中如何遍历Map对象How to Iterate Over a Map in Java在java中遍历Map有不少的方法。我们看一下最常用的方法及其优缺点。既然java中的所有map都实现了Map接口,以下方法适用于任何map实现(HashMap, TreeMap, LinkedHashMap, Hashtable, 等等)

2016-07-25 13:11:13 892

原创 Java 的一些常用代码片

开始笔记的搬家Java数据类型转换HashMap 迭代器访问java DateJava Split以竖线作为分隔符java 生成随机数

2016-07-25 12:47:22 752

转载 深度学习 资料整理

转自: http://blog.csdn.net/augusdi/article/details/20238157Deep Learning(深度学习)ufldl的2个教程(这个没得说,入门绝对的好教程,Ng的,逻辑清晰有练习):一ufldl的2个教程(这个没得说,入门绝对的好教程,Ng的,逻辑清晰有练习):二Bengio团队的deep learni

2016-04-28 16:23:03 1371

原创 Scala进阶源码实战之八——隐式转换和隐式参数

隐式转换import scala.io.Sourceimport java.io.Fileclass RichFile(val file:File){ def read = Source.fromFile(file.getPath()).mkString}object Context{ implicit def file2RichFile(file:File)= new RichF

2016-04-21 22:17:47 951

原创 Scala进阶源码实战之七——链式调用、结构类型

链式调用风格 //核心就在 this.typeclass Animal { def breathe: this.type = this } class Cat extends Animal { def eat : this.type = this } object Singleton_Types { def main(args: Array[String]): Unit = { val

2016-04-21 20:34:41 1185

原创 Scala进阶源码实战之六——类型变量

View Bounds 视图界定 package com.dt.scala.type_parameterization

2016-04-21 20:31:32 728

原创 Scala进阶源码实战之五——List、Queue、Stack、Set、Map

Listpackage databaseobject list { println("Welcome to the Scala worksheet") //> Welcome to the Scala worksheet val bigData = List("Hadoop" , "Spark") //> bigData : List[String] = Lis

2016-04-19 23:02:38 1066

迷宫问题求解

经典迷宫问题的求解的C源代码。学习过程中亲自写的运行实用使用回溯法,代码简洁清晰。

2014-09-07

集体智慧编程pdf

集体智慧编程》由美国计算机专家西格兰编著,以机器学习与计算统计为主题背景,专门讲述如何挖掘和分析Web上的数据和资源,如何分析用户体验、市场营销、个人品味等诸多信息,并得出有用的结论,通过复杂的算法来从Web网站获取、收集并分析用户的数据和反馈信息,以便创造新的用户价值和商业价值。

2014-08-07

空空如也

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

TA关注的人

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