自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(26)
  • 收藏
  • 关注

原创 Go语言 简单爬虫

goquery : https://github.com/PuerkitoBio/goquery首先,在这里介绍使用一个叫goquery的包,这个是go语言写爬虫非常好用的一个包,包含了网络连接和元素处理等。先来试试go get github.com/Puerkito/goquery如何从github.com下载与配置包已经在之前的文档中解释: Git指令使用现在发现,这里无法get这个包,提示的...

2018-03-15 12:39:46 1530

原创 Hadoop-3.0.0环境搭建

硬件:两台以上不同机器,可以用虚拟机服务器上在vmware文件夹中有vmware的安装程序,也有虚拟机的镜像文件。需要的包在ftp上也有:jdk-8u161-linux-x64.tar.gz                                   hadoop-3.0.0.tar.gz系统:Ubuntu-17.0.4搭建步骤1. 修改hostname: ubuntu@ubuntu:~$...

2018-03-13 17:45:31 409

原创 Go语言 并发测试

测试Go语言的并发性能,利用之前写的接入数据库的代码,实现1000条、10000条数据的更新插入数据 update_sql.go:package mainimport( "fmt" "database/sql" _ "github.com/lib/pq" )var quit chan int = make(chan int)func checkErr(err error){ i...

2018-03-13 12:32:44 3101

原创 Go语言 连接数据库

数据库使用与搭建:数据库:PostgresqlUbuntu下安装: apt-get install postgresql安装完成后,命令行输入 sudo su postgres,然后输入psql,登入postgres角色下的psql系统,注意连入数据库后每一句指令尾都要有分号。创建新用户:create user xxx with password'xxxxx';创建数据库:create datab...

2018-03-13 10:01:08 391

原创 GO语言 环境搭建与git指令的使用

#Go语言中文网:https://studygolang.com/Go语言简介:    说起爬虫,都会想到Python中的urllib2、Scrapy、selenium等包。但当涉及到大量的网址需要爬取时,对单台机器的爬虫速度要求很高。Python中的多线程或者高并发爬虫实现起来较为麻烦,这时候原生并发的Go语言就能派上很大的用场。Go语言本身支持并发编程,相比起Python等解释型语言,它的编译...

2018-03-13 09:51:12 4689

原创 scrapy入门

scrapy是很实用的网络爬虫工具,然而由于之前没有对python进行系统的学习,bug很多,进程十分缓慢,将今天的学习过程写下来。1.安装scrapy  可以直接在目录下pip install scrapy,然而这样有一定可能会报错,找不到关联的包。于是现在我们需要下载安装pywin32这个包,pip似乎无法直接安装这个包,推荐用下面这个地址直接安装http://www.softpe

2017-07-20 17:15:14 260

原创 算法期末作业 NP问题证明

算法期末作业 NP问题证明8.15MAXIMUM COMMON SUBGRAPHInput: Two graphs G1=(V1,E1) and G2=(V2,E2) ; a budget b .Output: Two set of nodes V′1?V1 and V′2?V2 whose deletion leaves at least b nodes in each grap

2017-07-11 15:02:08 753

原创 508. Most Frequent Subtree Sum

难度:MediumGiven 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 no

2017-06-12 12:12:33 196

原创 leetcode 303. Range Sum Query - Immutable

难度:easyGiven an integer array nums, find the sum of the elements between indicesi and j (i ≤ j), inclusive.这道题其实是一个很简单的求和,但是由于给出题目的调用方式跟以往的不一样,那就一定得用动态规划的方式。采取的是取用前面用过的值,保存了在一个临时的变量里面,然后pu

2017-06-03 16:29:33 250

原创 leetcode 53. Maximum Subarray

难度:EasyFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-

2017-05-31 17:58:14 198

原创 leetcode 343. Integer Break

难度:MediumGiven a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given

2017-05-18 20:19:36 175

原创 leetcode 198. House Robber

难度:easy这虽然是道easy题,但是仍旧让我卡了很久,其实就是选择奇偶性。代码如下 int rob(vector& nums) { if(nums.size()==0) return 0; else if(nums.size()==1) return nums[0]; int a=0,b=0;

2017-05-18 18:36:28 179

原创 leetcode 338. Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 y

2017-05-02 18:26:12 194

原创 leetcode 55. Jump Game

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.Determine if

2017-04-24 20:55:56 273

原创 leetcode 392. Is Subsequence

难度:MediumGiven a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s andt. t is potentially a very long (length ~=

2017-04-19 21:09:06 279

原创 leetcode 145. Binary Tree Postorder Traversal

难度:HardGiven a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].这道题只是求一个树的后序遍历的问题,唯一

2017-04-10 19:53:45 194

原创 leetcode 154. Find Minimum in Rotated Sorted Array II

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.The array may contain dupl

2017-04-10 00:46:04 173

原创 leetcode 207. Course Schedule

难度:MediumThere are a total of n courses you have to take, labeled from 0 ton - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is exp

2017-03-31 22:15:42 230

原创 leetcode41. First Missing Positive

难度:hardGiven an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses c

2017-03-25 23:01:56 195

原创 leetcode 128. Longest Consecutive Sequence .

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3,

2017-03-17 21:18:31 204

原创 leetcode 23. Merge k Sorted Lists

难度:hardMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题解:题目直接翻译过来就是 mergersort一共k个链表 那么既然它题目已经给出了mergesort的这个提示 那么用merge来排序就不会超过时间复杂度主要考虑还是要用

2017-03-10 00:40:42 157

原创 leetcode 274. H-Index

难度: MediumGiven an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on

2017-03-06 12:07:36 281

原创 leetcode 25. Reverse Nodes in k-Group

难度:hardGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the

2017-03-03 17:12:36 184

原创 leetcode 215. Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.

2017-03-03 17:03:13 186

原创 Leetcode 84. Largest Rectangle in Historam

难度: HardGiven n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where

2017-02-27 19:42:39 262

原创 LeetCode02 Add Two Numbers

题目 :02 Add two numbers  难度:Medium解题思路:本来就不是一个很难的问题。我一开始是把两个linked list转换为两个整数,然后进行相加,发现会溢出,而且对计算的数字有很大的限制,于是就改用按位相加的方法,具体步骤如下:1. 构造vector,用来存储获得的位2. 提取l1和l2的当前结点 分成四种情况来进行计算,分别是(判断当前结点是否为空

2017-02-22 17:37:07 265

空空如也

空空如也

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

TA关注的人

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