自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(143)
  • 资源 (11)
  • 收藏
  • 关注

原创 LeetCode OJ-129.Sum Root to Leaf Numbers

LeetCode OJ-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 whi

2017-09-10 12:31:27 523

原创 以太网帧格式

以太网帧格式概述​ 在以太网链路上传输的数据包可以称作以太网帧。以太网帧由前导码和帧起始符组成起始部分,后面即是以太网头部,中部则是该帧负载的其他协议数据包。以太网帧以1个32位的冗余校验码j结尾,用于检测数据传输是否被损坏。802.3以太网帧结构(以mtu为1500说明) 前导码 帧起始符 MAC目的地址 MAC源地址 802.1Q标签(可选) 以太网类型 负载

2017-09-10 11:15:29 1953

原创 awk基础入门

awk基础入门概述​ awk是Linux上一款功能比较强大的文本分析处理工具,相对于grep的查找,sed的编辑,awk支持对文本进行分析、处理之后,生成处理结果或者报告,awk本身就支持一套类似于Shell Script的脚本,更加强化了awk的分析功能。awk指定分隔符简单提取数据​ 默认情况下,awk将输入逐行读取,以空格为默认分隔符,将每行的关键文本隔离成多个域,使用’$’ + 数字

2017-08-30 08:40:41 569

原创 Makefile学习笔记(三)

Makefile学习笔记(三)概述​ 只依靠简单的变量和模式规则写一个复杂项目的Makefile是比较困难的,也不是不能写,只是源文件一多,模式规则的量就很大。庆幸的是,make提供了一些函数,可以很方便地写出复杂项目的Makefile。这里就来记录一下两个比较常用的make函数。make函数调用形式​ make函数调用,与变量获取形式类似: $(func param),参数param根据所

2017-07-27 19:45:54 494

原创 LeetCode OJ-34.Search for a Range

LeetCode OJ-34.Search for a Range题目描述 Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s runtime complexity mus

2017-07-16 22:04:50 443

原创 Shell Programming(二)——编写守护进程脚本

Shell Programming(二)——编写守护进程脚本概述​ 在Linux开发中,常遇到需要编写守护进程程序的场景,这时候视情况而定,能使用Shell Script编写那自然就方便很多了。这里就来编写一个守护进程脚本,以作参考。获取需要守护的进程pid​ 获取进程信息常用ps指令进行查询,比较常用的是-ef选项,获取所有进程信息则可以这样写:ps -ef ​ 有了上面这步,我们可以

2017-06-04 21:17:10 1021

原创 Shell Programming(一)——重定向与管道

Shell Programming(一)——重定向与管道概述​ 很长时间没在Linux进行开发,很多Linux Shell相关的点都快忘了。今天重新捡起来,也做一点记录,以便后续遇到相关问题可以有笔记可查。​ Linux下的开发,很多地方都离不开Shell脚本的编写,一些批处理操作,打包之类的,要想快速高效地做好Linux开发,还是要对Shell熟悉啊。这里先从两个比较常用的功能说起。重定向

2017-05-16 10:33:03 640

原创 LeetCode OJ-392.Is Subsequence

LeetCode OJ-392.Is Subsequence题目描述 Given 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 and t. t is potentially

2017-05-12 16:11:28 500

原创 LeetCode OJ-560.Subarray Sum Equals K

LeetCode OJ-560.Subarray Sum Equals K题目描述 Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums

2017-05-06 15:56:47 832

原创 LeetCode OJ-513.Find Bottom Left Tree Value

LeetCode OJ-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:1 Example 2:

2017-05-02 17:33:25 629

原创 LeetCode OJ-338.Counting Bits

LeetCode OJ-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 a

2017-04-28 14:17:25 437

原创 LeetCode OJ-419.Battleships in a Board

LeetCode OJ-419.Battleships in a Board题目描述 Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume th

2017-04-27 12:22:42 485

原创 LeetCode OJ-537.Complex Number Multiplication

LeetCode OJ-537.Complex Number Multiplication题目描述 Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the

2017-04-26 17:59:26 631

原创 LeetCode OJ-4.Median of Two Sorted Arrays

LeetCode OJ-4.Median of Two Sorted Arrays题目描述 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

2017-04-25 20:26:39 439

原创 堆排序原理及实现

堆排序原理及实现概述​ 排序算法在程序设计中属于使用频度很高的一类算法,好的排序算法对于程序效率的提升有一定作用。常见的简单排序算法如冒泡排序、插入排序,对于多数情况来说O(n^2)的时间复杂度并不是太理想,效果较好的归并排序倒是时间复杂度达到O(n * lgn)了,可惜要使用额外的数组空间。所幸,有一种和归并排序效率差不多的原地排序算法——堆排序。这里就记录一下堆排序的原理及实现细节。堆的基本

2017-04-18 09:45:05 1396

原创 图论基础(二)

图论基础(二)图的连通性​ 如果无向图G=(V, E)中每一个顶点到其它任意顶点都是可达的,则称G是连通的。假定有无向图G=(V, E),V={ 1, 2, 3, 4 },E={ (1, 2), (1, 3), (3, 4) },则G的结构如下图:​ 如果有向图G=(V, E)中任意两个顶点互相可达,则称G为强连通图。如果有向图G=(V, E)不是强连通图,但将G中的边去掉方向之后,是一个连

2017-04-13 15:45:55 970

原创 图论基础(一)

图论基础(一)有向图定义​ 有向图G是一个二元组(V, E),记为G=(V, E)。 其中V是有向图G的顶点集合,是一个有限集合,元素为顶点;E是有向图G的边集合,元素为边,边也是一个二元组(u, v),其中u,v是有向图G的顶点集合中的元素,(u, v)在这里是有方向的边,以u为起点,指向v的一条有向路径。u可以与v相同,代表自身指向自身的一个自环路径。​ 假定存在有向图G=(V

2017-04-12 17:53:16 904

原创 LeetCode OJ-20.Valid Parentheses

LeetCode OJ-20.Valid Parentheses题目描述 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct

2017-03-21 10:19:22 391

原创 LeetCode OJ-19.Remove Nth Node From End of List

LeetCode OJ-19.Remove Nth Node From End of List题目描述 Given a linked list, remove the *n*th node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, an

2017-03-20 16:48:11 467

原创 LeetCode OJ-14.Longest Common Prefix

LeetCode OJ-14.Longest Common Prefix题目描述 Write a function to find the longest common prefix string amongst an array of strings. Subscribe to see which companies asked this question. Show Ta

2017-03-14 17:35:51 644

原创 Trie树结构与实现

Trie树结构与实现概述​ 在平时使用搜索引擎或者一些其他工具时,常会有一些智能提示,或许我们需要搜索的内容并不存在,但这些工具都会尽量选择前缀尽可能相似的结果给我们。这里使用到的前缀匹配,大多则是使用Trie树进行处理。Trie树基本定义​ Trie树,又被称为前缀树或字典树,与其用途有关,Trie树是一种有序树,用于保存关联数组,其中的Key通常是字符串。与二叉查找树不同,Key并不直接

2017-03-14 17:27:27 754

原创 LeetCode OJ-6.ZigZag Conversion

LeetCode OJ-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 le

2017-03-09 17:01:34 449

原创 LeetCode OJ-2.Add Two Numbers

LeetCode OJ-2.Add Two Numbers题目描述 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digi

2017-03-09 14:51:46 594

原创 设计模式(四)——观察者模式

设计模式(四)——观察者模式模式动机​ 将一个系统设计为一系列相互协作的类,往往也会带来一些副作用,类对象之间的一致性需要维护。​ 观察者模式定义了一种交互,即发布-订阅:对象自身状态的改变,需要通知相关协作的类对象,这些对象称为观察者;作为对通知的响应,相关的观察者会对自身状态做出一定更新,以同步系统中状态的变化。模式定义​ 观察者模式定义了一种对象间一对多的依赖关系,使得当每一

2017-03-02 12:32:56 529

原创 Boost库简单运用——shared_ptr

Boost库简单运用——shared_ptr概述​ 在C++项目中,内存管理的问题一直是个大问题,也是个很常见的问题。项目交由经验不足的程序员来编写维护,常出现内存泄漏、访问非法内存之类的问题,资历较老的程序员也不可避免会出错。所幸STL与Boost都为我们提供了管理动态内存的工具,我们只要如寻常指针一般使用即可,无需担心以往会出现的内存管理上的问题了。这里就先介绍一个shared_ptr,就功

2017-03-01 20:02:00 1118

原创 使用C/C++预定义宏进行调试跟踪代码

使用C/C++预定义宏进行调试跟踪代码概述​ 编写C/C++代码时,控制台调试/错误输出是比较常用而且主要的代码调试、排错方法。幸好各大编译器都支持一些预定义的宏可以方便我们在编写代码时,获取代码文件路径、名字,代码行号,编译时间等。​ 这里要说的主要是如下几个:__FILE__, __LINE__, __DATE__, __TIME__, __FUNCTION__.用途__FILE__:

2017-02-16 11:38:56 1785

原创 括号匹配算法

括号匹配算法概述​ 括号匹配在很多字符串处理的场景中时常被用到,诸如各大IDE括号不匹配的错误提示,编译器编译时检查应该成对出现的括号是否符合要求等,在这里我们就直接使用一种比较常规,但效率不差的方法去解决括号匹配的问题就行了。栈方法匹配问题​ 为了方便描述,对于需要做匹配的两个符号,比如’(‘和’)’,前者可称为左侧符号,后者可称为右侧符号。在做符号匹配时,如果以左侧符号为标准,左侧符号需

2017-02-13 11:11:41 22502 3

原创 JavaScript使用Window Location进行页面跳转

JavaScript使用Window Location进行页面跳转概述​ 在Web开发中,常有页面跳转的需要,跳转页面的方式也有很多种,不过这里仅介绍使用window.location的方法,这种方法既可以用于具有onclick事件的标签,也可以用于满足某些条件进行跳转,使用起来更方便更灵活一些。window.location​ window.location对象用于获得当前页面的地址(UR

2017-01-22 11:38:54 35679

原创 LeetCode OJ-78.Subsets

LeetCode OJ-78.Subsets题目描述 Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3],

2017-01-17 15:33:22 448

原创 LeetCode OJ-77.Combinations

LeetCode OJ-77.Combinations题目描述 Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4]

2017-01-16 18:48:29 443

原创 LeetCode OJ-74.Search a 2D Matrix

LeetCode OJ-74.Search a 2D Matrix题目描述 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from

2017-01-16 09:24:38 553

原创 LeetCode OJ-64.Minimum Path Sum(DP)

LeetCode OJ-64.Minimum Path Sum(DP)题目描述 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note

2017-01-13 12:00:58 360

原创 LeetCode OJ-62. Unique Paths(DP)

LeetCode OJ-62. Unique Paths(DP)题目描述 A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in

2017-01-12 12:32:18 417

原创 LeetCode OJ-55.Jump Game

LeetCode OJ-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

2017-01-09 11:54:07 356

原创 LeetCode OJ-53.Maximum Subarray(最大连续子数组和)

LeetCode OJ-53.Maximum Subarray(最大连续子数组和)题目描述 Find 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,

2017-01-07 11:29:27 1113

原创 LeetCode OJ-49.Group Anagrams

LeetCode OJ-49.Group Anagrams题目描述 Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"],  Return: [ ["ate", "eat","tea"],

2017-01-07 10:45:26 511

原创 LeetCode OJ-46.Permutations(全排列问题)

LeetCode OJ-46.Permutations(全排列问题)题目描述 Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3

2017-01-06 17:00:48 572

原创 全排列生成算法

全排列生成算法概述​ 全排列问题,简单来说,就是由n个不同元素组成的序列,从中取出n个元素,按不同顺序排列起来。如:”123”,它的全排列为,”123”,”132”,”213”,”231”,”312”,”321”,总共有n!种结果。解法一:回溯法求解​ 对于求解所有可能情况的问题,回溯法不失为一种可以解决问题的方法。对于全排列生成,可以把序列的每一个字符作为一层,也可以说是,固定一个字符,对

2017-01-06 14:56:01 746

原创 LeetCode OJ-22.Generate Parentheses(回溯法)

LeetCode OJ-22.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:

2017-01-03 19:41:54 847

原创 LeetCode OJ-18.4Sum(四数和)

LeetCode OJ-18.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 t

2017-01-03 16:17:15 510

整型链表实现

整型链表实现 C++。

2013-10-17

搜索二叉树(整型)

搜索二叉树(整型) C++.

2013-10-17

C#版插入排序

C#版插入排序

2013-09-24

WPF 控件元素绑定简单示例

WPF 控件元素绑定简单示例

2013-09-17

C#接口示例

C#接口示例

2013-09-16

C#委托类型简单使用

C#委托类型简单使用

2013-09-16

C#属性及类的简单实用

C#属性及类的简单实用

2013-09-16

C#指针简单运用

C#指针简单运用

2013-09-16

C# Lamda表达式简单运用

C# Lamda表达式简单运用

2013-09-16

C++练习题经典

C++经典练习题,考试必备!适合初学者

2012-12-05

C语言100例

C语言100例,适合初学者!

2012-12-05

空空如也

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

TA关注的人

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