自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

gannyee

成长在于积累,分享是种美德!

  • 博客(59)
  • 资源 (7)
  • 收藏
  • 关注

原创 Nutch+MongoDB+ElasticSearch+Kibana 搭建搜索引擎

前言: 文章讲述如何通过Nutch、MongoDB、ElasticSearch、Kibana搭建网络爬虫,其中Nutch用于网页数据爬取,MongoDB用于存储爬虫而来的数据,ElasticSearch用来作Index索引,Kibana用来形象化查看索引结果。具体步骤如下:配置环境:系统环境:Ubuntu 14.04JDK版本:jdk1.8.0_45 通过wget获取下载安装包:gannye

2016-01-28 00:22:42 7312

原创 LeetCode解题报告--Remove Element

题目: Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn’t matter what you leave beyond the new length

2015-10-18 10:44:19 1079

原创 LeetCode解题报告--Remove Duplicates from Sorted Array

题目: 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 plac

2015-10-18 10:10:06 639

原创 LeetCode解题报告--Reverse Nodes in k-Group

题目 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as

2015-10-17 23:48:15 914

原创 LeetCode解题报告--Swap Nodes in Pairs

题目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant

2015-10-17 11:11:31 1629

原创 java制作视频播放器

前言国庆前几天,无意中看到关于VLCJ包的文章,可以导入java工程制作自己的java视频播放器,感觉有意思,就自己捣鼓几天,做出了个功能较为齐全的跨平台的视频播放器,高级功能之后有时间再弄,我把项目的源码放在自己的Github上,大家感兴趣的可以下载。我会在之后的博客里分享制作这个视频的过程,把重要的代码贴在博客里,分享一下项目过程遇到的问题,及如何解决。本文主要介绍完成后的视频的界面和功能,以及

2015-10-02 12:12:02 45136 27

原创 LeetCode解题报告--Merge k Sorted Lists

**题目:**Merge k Sorted Lists Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析:题意要求将k个排好序的链表,整合为一个排好序链表,该题是之前的合并两个排好序的链表的延伸,延伸为一般情况。基本思想与两链表合并一样,

2015-09-26 12:37:43 865

原创 LeetCode解题报告--Generate Parentheses

**题目:**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-09-25 13:56:08 741

原创 LeetCode解题报告--Merge Two Sorted Lists

**题目:**Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:题意要求将两个排好序List链表整合

2015-09-25 10:53:15 1024

原创 LeetCode解题报告--Valid Parentheses

**题目:**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, “()

2015-09-25 10:23:26 660

原创 LeetCode解题报告--Remove Nth Node From End of List

**题目:**Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removin

2015-09-25 09:58:55 795

原创 LeetCode解题报告--2Sum, 3Sum, 4Sum, K Sum求和问题总结

前言: 这几天在做LeetCode 里面有2sum, 3sum(closest), 4sum等问题, 这类问题是典型的递归思路解题,该这类问题的关键在于,在进行求和求解前,要先排序Arrays.sort()可实现,而本文则着重探讨关于KSum问题。 leetcode求和问题描述(K sum problem): K sum的求和问题一般是这样子描述的:给你一组N个数字(比如 vector

2015-08-17 18:22:02 3825

原创 LeetCode解题报告--4Sum

题目: 4Sum Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: Elements

2015-08-17 17:54:37 954

原创 LeetCode解题报告--Letter Combinations of a Phone Number

题目:字母组合的电话号码 Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below. Input:D

2015-08-17 17:43:42 2581

原创 树结构的自定义及基本算法(Java数据结构学习笔记)

数据结构可以归类两大类型:线性结构与非线性结构,本文的内容关于非线性结构:树的基本定义及相关算法。关于树的一些基本概念定义可参考:维基百科 树的ADT模型: 根据树的定义,每个节点的后代均构成一棵树树,称为子树。因此从数据类型来讲,树、子树、树节点是等同地位,可将其看作为一个节点,用通类:Tree表示。如下图所示: 图:Tree ADT模型示意图 可采用“父亲-儿子-兄弟”模型来表示树的

2015-08-16 20:07:26 7358

原创 LeetCode解题报告--3Sum Closest

题目:与3数和最接近的和 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would

2015-08-16 16:46:24 1110

原创 LeetCode解题报告--3 Sum

题目: 3 个数和问题 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: Elements in a triplet (a,b

2015-08-16 16:37:27 1576 1

原创 LeetCode解题报告--Longest Common Prefix

题目:最长公共前缀 Write a function to find the longest common prefix string amongst an array of strings.分析:题意找出所有字符串的最长公共前缀。 思路简单:如下步骤 1. 找出字符串数组中字符串长度最小的字符串minStr 2. minStr与其余的字符串逐个字符比较,确定最长公共前缀java 代码:(a

2015-08-14 15:43:40 1585

原创 LeetCode解题报告--Roman to Integer

题目:罗马数字转为阿拉伯数字 Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 分析:题意:将给定的罗马数字转为阿拉伯数字 从前往后遍历罗马数字,如果某个数比前一个数小,则把该数加入到结果中; 反之,则在结果中两次减去前一个数并加

2015-08-13 19:46:54 1027

原创 LeetCode解题报告--Integer to Roman

题目:阿拉伯数字转罗马数字Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.原题链接地址:https://leetcode.com/problems/integer-to-roman/ 分析:题意将阿拉伯数字num转罗马数字 拼写

2015-08-13 19:39:20 932

原创 LeetCode解题报告--Container With Most Water

题目:最大的盛水容器Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fi

2015-08-13 17:37:37 832

原创 LeetCode解题报告--Palindrome Number

题目:回文数字的判断 Determine whether an integer is a palindrome. Do this without extra space.Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to strin

2015-08-13 17:28:51 1552

原创 串口编程项目— PX4FLOW 传感器数据接收处理(英文paper直接贴过来)

写在前面: 七月份初,结束交流生项目,向导师申请了个项目,关于PX4FLOW传感器的,serial programming 的java编程,下午刚刚提交完paper,写个总结,把项目的一些知识分享。以下为本人项目总结后的英文版paper,直接贴过来,由于接下来忙于准备面试,没时间翻译,等回国再翻译。 具体的源代码和完整paper在个人github。https://github.com/ganny

2015-07-24 00:02:32 5263

原创 Java 基于数组自定义实现容量可变向量Vector

数组容量N固定。一方面,在向量规模很小时,预留这么多的空间实属浪费;反过来,当向量规模超过N时,即使系统有足够的空间资源,也会因 意外错而崩溃。幸好,有一个简易的方法可以克服这一缺陷。我们希望向量能够根据实际需要,动态地扩充数组的容量。当然, Java 语言本身并不支持这一功能,与多数程序语言一样, Java 中数组的容量都是固定的。我们的策略是,一旦数组空间溢出(即size≥CAPACITY),

2015-06-21 06:20:07 1487

原创 Java 基于数组自定义实现容量不可变向量Vector

背景:假定集合 S 由 n 个元素组成,它们按照线性次序存放,于是我们就可以直接访问其中的第一个元素、第二个元素、第三个元素……。也就是说,通过[0, n-1]之间的每一个整数,都可以直接访问到唯一的元素 e,而这个整数就等于 S 中位于 e 之前的元素个数⎯⎯在此,我们称之为该元素的秩( Rank)。不难看出,若元素 e 的秩为 r,则只要 e 的直接前驱(或直接后继)存在,其秩就是 r-1(或

2015-06-19 06:48:55 1230

原创 基于双链表 实现Java Queue队列

除了可以通过一维数组,单链表实现queue队列,还可以通过双链表实现queue队列。在基于NLNode类实现双向链表的时候,为了使编程更加简洁,通常我们都要在最前端和最后端各设置一个哑元节点( Dummy node )。这两个节点分别称作头节点( Header node )和尾节点( Trailer node) ㈠,起哨兵( Sentinel)的作用。也就是说,它们并不存储任何实质的数据对象,头(尾

2015-06-14 21:02:58 965

原创 基于链表实现Java 自定义Queue队列

与栈一样,我们也可以借助单链表来实现队列ADT。同样地,出于效率方面的考虑,我们将以单链表的首(末)节点作为队列的首(末)节点⎯⎯这样,可以回避单链表在尾部进行删除操作时效率低下的缺陷。此外,还需要两个实例变量分别指示表的首、末节点。java代码如下:QueueList:package com.list.queue;import java.util.Arrays;import com.list.s

2015-06-14 00:32:00 2944

原创 基于链表实现Java 自定义Stack栈

接下来让我们看看,如何利用单链表结构来实现栈与队列。由于栈的操作只限于栈顶元素,而单链表只有对首元素才能在O(1)时间内完成插入和删除,故这里把单链表的首节点作为栈顶,其余元素依次排列。此外,为了保证getSize()方法也能够在O(1)时间内完成,还需借助一个实例变量来动态记录栈中元素的数目。具体的实现如 代码二.12 所示。Node类 Java代码见( Java 实现链表)StackLink 类

2015-06-12 23:57:14 2036

原创 Java 实现链表

链表相比数组操作更灵活,在空间效率方面比数组更有优势,虽然java中没有指针,但可以通过自定义类建立链表模型,进而实现链表。 分享下自己用java实现链表的过程: java代码: Node 类:package com.list.stack;/** * Setup Node class * @author gannyee * */public class Node { //D

2015-06-12 23:47:44 1778 1

原创 基于数组实现Java 自定义Queue队列及应用

Java 自定义队列Queue:队列的抽象数据类型就是一个容器,其中的对象排成一个序列,我们只能访问和取出排在最前端( Front)的对象,只能在队列的尾部( Rear)插入新对象。正是按照这一规则,才能保证最先被插入的对象首先被删除( FIFO)。java本身是有自带Queue类包,为了达到学习目的已经更好深入了解Queue队列,自己动手自建java Queue类是个很好的学习开始: 基于数组的

2015-06-10 00:08:25 5625

原创 基于数组实现Java 自定义Stack栈类及应用

栈是存放对象的一种特殊容器,在插入与删除对象时,这种结构遵循后进先出( Last-in-first-out,LIFO)的原则。java本身是有自带Stack类包,为了达到学习目的已经更好深入了解stack栈,自己动手自建java stack类是个很好的学习开始:自建Java Stack 类Stack 类:package com.stack;import java.util.ArrayList;im

2015-06-09 00:02:32 3582

原创 LeetCode解题报告--String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.N

2015-06-05 05:28:49 831

翻译 银行家算法

银行家算法是资源和死锁避免的算法,由艾兹格·迪杰斯特拉(Edsger Dijkstra) 设计的算法用于测已确定总数量的资源分配的安全性,在决定是否该分配应该被允许并进行下去之前,通过“s-state”校验码测试资源分配活动期间产生死锁条件的可能性。     该算法是为为THE操作系统设计并且最在在EWD108描述。当一个新的进程进入系统时,进程必须声明所需每个资源实例最大的数量和类型。显然,资源

2015-06-05 00:39:27 37177

原创 LeetCode解题报告---Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321原题出处:https://leetcode.com/problems/reverse-integer/解题思路:如果输入”100”,”10000”,反转之后输出时应考虑前导‘0’;输入溢出时时以及反转输出时溢出直接

2015-06-03 03:55:18 690

原创 Reverse Integer 解题报告

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321原题出处:https://leetcode.com/problems/reverse-integer/解题思路:如果输入”100”,”10000”,反转之后输出时应考虑前导‘0’;输入溢出时时以及反转输出时溢出直接

2015-06-03 01:31:45 729

原创 LeetCode解题报告--ZigZag Conversion

题目来源:https://leetcode.com/problems/zigzag-conversion/P AH N AP LS I I G YI R 解法一: 间距为: icount = 2 * (nRows - 1) 每列的字符个数为:i = nRows[from 0 to (nRows - 1)] 中间未加粗字符其下标为: mid = j + icount - 2 * i

2015-06-02 00:04:47 753

转载 Java中equals()与hashCode()方法详解

Java中equals()与hashCode()方法详解一.equals()方法详解 equals()方法在object类中定义如下: Java代码 收藏代码 public boolean equals(Object obj) { return (this == obj); } 很明显是对两个对象的地址值进行的比较(即比较引用是否相同)。但是我们知

2015-05-30 17:42:25 779

原创 Java连接mysql七步!

Java如何连接mysql数据库,本归纳总结7步,即可顺利达成! 前提你的java项目已经导入下载好的jdbc驱动包!! 没有可以此处下载 1> 声明驱动变量 driver://Database Driverprivate static final String driver = "com.mysql.jdbc.Driver";2> 声明mysql连接地址url://URL address

2015-05-27 16:11:25 3246

原创 java 小项目:简单扑克牌游戏

项目要求 1>新建两个玩家 2>创建扑克牌,洗牌 3>发牌,每个玩家没人拿两张,比较大小 4>比较规则:两个玩家选出各种最大的牌,进行游戏,先比较点数大小,点数大的获胜,点数相同则比较花色:黑桃>红心>梅花>方块 5>输出要求:结束时分别输出玩家的手牌情况。运行结果截图: Java源码: Card类:package com.card;import java.util.ArrayLis

2015-05-27 05:44:38 7798 1

原创 LeetCode解题报告--Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 题目来源:https://leetcode.com

2015-05-17 16:15:36 834

slf4j-1.7.12.zip

在基于vlcj包开发自己的视频播放器,其中slf4j-api-1.7.12.jar依赖slf4j-simple-1.7.12.jar,而vlcj jar包里没有,需要自己下载。

2015-10-02

vlcj-3.8.0.zip

vlcj-3.8.0 java视频制作必须包之一

2015-10-02

Mutual Exclusion

英文版ppt 关于操作系统的互斥原理ppt文档 English Version ppt, which about mutual Exclusion for Opera System

2015-05-26

vlc播放器 32位

vlc播放器 32位 用于开发自己java视频播放器所必须工具,利用vlcj开发视频需要调用vlc播放器内核

2015-10-02

java数据结构.pdf

在内容选取、剪裁与体例结构上,作者力图突破现成的模式。这里并未对各种数据结构面面俱 到,而是通过分类和讲解典型结构,力图使读者形成对数据结构的宏观认识;结合各部分的具体内 容,书中都穿插了大量的问题,把更多的思考空间留给读者。

2015-06-19

JDBC驱动包

JDBC驱动包用于java连接mysql必备

2015-05-27

空空如也

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

TA关注的人

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