- 博客(19)
- 收藏
- 关注
原创 Java排序:冒泡排序、快速排序、堆排序
冒泡排序: 一趟排序:将第一个记录和第二个记录进行比较,如果第一个比第二个大就两个记录交换,直到第n-1个记录和第n个记录比较为止。 之后的排序对前n-1个记录进行同样操作。 时间复杂度为O(n^2)每一趟排序就是把最大的数放到最后面。快速排序: 一趟交换:设两个指针low和high,设枢轴记录为pivotkey,从high所指的位置向前搜索找到第一个关键词小于pivotkey的记录和...
2018-02-27 13:43:26
358
原创 《Java设计模式》中出现的问题汇总
1. 写出在Java中抽象类和接口的区别。一个类可以实现多个接口,但只能继承最多一个抽象类。抽象类可以包含具体方法;接口的所有方法都是抽象的。抽象类可以声明和使用字段;接口不能,但可以创建静态的final常量。抽象类中的方法可以是public、protected、private或者默认的package;接口的方法都是public。抽象类可以定义构造函数;接口不能。2. 示例类和外观类的区别。示例通...
2018-02-22 15:13:32
669
转载 【Leetcode解题记录】4. Median of Two Sorted Arrays
转载于:【分步详解】两个有序数组中的中位数和Top K问题有时间还是要写一下两个数组的Top K代码There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity sho...
2018-02-14 21:17:35
265
原创 【Leetcode解题记录】17. 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:Digit string "23"...
2018-02-13 16:38:21
214
原创 【Leetcode解题记录】15. 3Sum
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: The solution set must not contain dupli...
2018-02-12 23:24:34
210
原创 【Leetcode解题记录】12. Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.-------比较简单,只要了解罗马数字的转换即可。对应规则如下:{"","I","II","III","IV","V","VI","VII"
2018-02-12 23:16:16
178
原创 【Leetcode解题记录】11. 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). Find two ...
2018-02-12 23:08:44
158
原创 【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 legibility)P A H NA P L S I I G...
2018-02-12 23:00:17
185
转载 【Leetcode解题记录】3. Longest Substring Without Repeating Characte
寻找最长不重复字串Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", w...
2018-02-12 22:55:34
155
转载 【Leetcode解题记录】5. 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.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer. Example:I...
2018-02-10 14:02:33
170
转载 Lucene 6.0以上版本使用IKAnalyzer分词器
Lucene 6.0使用IK分词器需要修改修改IKAnalyzer和IKTokenizer. 使用时先新建一个MyIKTokenizer类,一个MyIkAnalyzer类: MyIKTokenizer.javaimport java.io.IOException;import java.io.Reader;import org.apache.lucene.analysis.Tokenizer
2017-09-11 21:28:54
527
原创 使用Lucene词频统计与d3.cloud展示的中文英文词云系统
用Lucene 4.7对进行词频计算统计,使用的分词器为IKAnalyzer,对中文的支持较低。 中文计算词频仅包含中文,英文计算词频仅包含英文。可在中文解析器与英文解析器中进行修改。 在获取到排序好的词频后,可使用d3.cloud在web中展示出来。 Github地址:github.com/panzejia/WebGuidepackage cn.iflin.project.participl
2017-09-03 20:55:10
885
转载 Github上传代码菜鸟超详细教程【转+整合】
这篇文章写得是windows下的使用方法。第一步:创建Github新账户第二步:新建仓库第三部:填写名称,简介(可选),勾选Initialize this repository with a README选项,这是自动创建REAMDE.md文件,省的你再创建。第四步:安装Github shell程序,地址:http://windows.github.
2017-04-08 13:11:31
1291
转载 Jsoup 乱码问题解决
一般出现这个情况是由于url指向的页面,实际编码与html中描述的编码不符导致。如:开发时用的GBK编码编写,但html中却写UTF-8。典型的就是在中文Windows下用记事本,写一个UTF-8的html就会出现这个问题。你可以不用jsoup.connect,这个会从html描述中识别。你可以用Jsoup.parse(InputStream in, String charsetName, Stri
2017-04-07 10:46:45
2861
原创 Java出现的问题以及小技巧合集
在做Java项目时总会出现很多错误,所以将错误放在此处方便以后自己查阅修正。1.我在Maven一个github项目的时候一切导入正常,但是在pom.xml中出错Plugin execution not covered by lifecycle configuration: org.codehaus.gmavenplus:gmavenplus-plugin:1解决方法:在<plugins>...
2017-03-31 09:48:51
536
原创 Mysql 在Java中常用语法合集(不断更新)
获取到最新一条数据:select * from urlmanager where timedata=(select max(timedata) from urlmanager)
2017-03-30 10:36:04
757
转载 Class.forName()用法详解
主要功能Class.forName(xxx.xx.xx)返回的是一个类Class.forName(xxx.xx.xx)的作用是要求JVM查找并加载指定的类,也就是说JVM会执行该类的静态代码段下面,通过解答以下三个问题的来详细讲解下Class.forName()的用法。一.什么时候用Class.forName()?先来个热身,给你一个字符串变量,它代表一个类的包名和类名,你怎么实
2017-03-25 10:37:21
438
原创 Centos 7.2 搭建Apache+PHP+Mysql环境
现在腾讯云和阿里云都有针对学生的优惠政策,腾讯云每个月一块钱就有服务器加域名,阿里云每个月十块钱一个服务器,两个都可以去尝试使用下,这个博客放在腾讯云服务器上,搭建的是windows环境,另一个 摄影 网站搭建在阿里云服务器上,使用的是Linux系统。这次攻略是CentOS 7.2 搭建环境,从零开始;一步一步到搭建成功。 在安装程序之前,先执行更新yum upda
2017-03-22 08:50:28
444
转载 python 2 与 python 3 变化
基本语法变化int 和 long 统一为 int, 表现为 long真正的除法 1/2 => 0.5, 原语法退化为 1//2可用 nonlocal 声明非局部变量, 介于 global 和 local 之间去除元组参数解包, 不能再定义 def foo( (a, (b, c)) ): 了八进制语法变化: 0755 => 0o755比较不同时只支
2017-03-22 08:49:16
926
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅