自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Sly_461的博客

The journey begins!

  • 博客(143)
  • 收藏
  • 关注

原创 关于函数(二)数组指针和指针数组

参考http://blog.csdn.net/touch_2011/article/details/69669801、概述指针数组:指针数组可以说成是”指针的数组”,首先这个变量是一个数组,其次,”指针”修饰这个数组,意思是说这个数组的所有元素都是指针类型,在32位系统中,指针占四个字节。数组指针:数组指针可以说成是”数组的指针”,首先这个变量是一个指针,其次,”数组”修饰这个指针,意思是说这个

2017-07-19 01:42:56 659 1

原创 LeetCode#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-07-18 11:45:10 464

原创 关于函数(一)const与函数

一.const与函数1、概述        在普通的非 const成员函数中,this的类型是一个指向类类型的 const指针。可以改变this所指向的值,但不能改变 this所保存的地址。在 const成员函数中,this的类型是一个指向 const类类型对象的 const指针。既不能改变 this所指向的对象,也不能改变 this所保存的地址。        看到const关键字,C++程序

2017-07-18 11:43:04 1266

原创 LeetCode#21 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.题意:就是给你两个已经排好序的链表,然后叫你合并成一个链表。 思路:就是考链表的操作。代码:/** * Defin

2017-07-17 20:52:02 431

原创 LeetCode#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 order, “()” and “()[]{}” are all valid but “

2017-07-17 20:47:54 386

原创 LeetCode#15* 3Sum && LeetCode#16 3Sum Closest && LeetCode#18 4Sum

【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 contai

2017-07-17 20:37:18 541

原创 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

2017-07-17 20:36:53 521

原创 LeetCode#19 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 removing the second node from the end, the link

2017-07-17 20:36:22 360

原创 LeetCode#14 Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.题意:写一个函数(或方法)来寻找一个字符串数组中的最长公共前缀。 例如:”abcdefg”        ”abcdefghijk”        ”abcdfghijk”        ”abcef

2017-07-17 10:48:01 342

原创 LeetCode#12 Integer to Roman && #13* Roman to Integer(罗马数字转换)

12题: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.13题: Given a roman numeral, convert it to an integer. Input is guaranteed to b

2017-07-17 10:34:18 407

原创 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 lin

2017-07-17 09:59:33 483

原创 LeetCode#9* 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 string,

2017-07-17 02:43:12 393

原创 LeetCode#8 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 case

2017-07-17 02:20:35 359

原创 指针和const

一.定义       一般,说到指针和const,就分两种:const指针和指向const的指针。const指针是指针变量的值一经初始化,就不可以改变指向,初始化是必要的;而指向const的指针是说指针指向的变量是const的(其实这种说法也是不太准确的,和const引用有点像)可以这样理解:一种指的是你不能修改指针本身的内容,另一种指的是你不能修改指针指向的内容(只是说不能通过指针的方式去修改,如

2017-07-16 21:13:53 535

原创 关于const引用

一.定义       简单地说,const引用是指–指向const的引用(其实这样说不恰当,在我的理解中,const引用中的const只是限定了不能通过此引用去修改变量的值),和const指针一样,const引用可以与常量绑定,也可以与变量绑定,只是不能通过这个const引用来改变绑定对象的值,就如之后要讲的const指针类似。        另外,引用的对象是常量还是非常量可以决定其能参与的操作

2017-07-16 01:12:42 1348

原创 网络层(三)IP协议

IP协议用于将多个包交换网络连接起来,它在源地址和目的地址之间传送一种称之为数据包的东西,它还提供对数据大小的重新组装功能,以适应不同网络对包大小的要求。        IP的责任就是把数据从源传送到目的地。它不负责保证传送可靠性,流控制,包顺序和其它对于主机到主机协议来说很普通的服务。        IP实现两个基本功能:寻址和分段。IP可以根据数据包包头中包括的目的地址将数据包传

2017-07-08 17:19:34 848

原创 LeetCode#7 Reverse Integer

Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers.Note: The input is assumed to be a 32-bit signed integer. Your function shou

2017-07-05 19:18:01 317

原创 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 N A P L S I

2017-07-05 19:10:19 351

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

2017-07-05 18:23:00 406

原创 LeetCode#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 should be O(log (m+n)). Example 1: nums1 = [1,

2017-07-05 15:36:44 368

原创 LeetCode#3* Longest Substring Without Repeating Characters

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

2017-07-05 12:52:21 275

原创 LeetCode#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 digit. Add the two numbers and return

2017-07-05 11:45:40 359

原创 LeetCode#1 Two Sum

题意:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same

2017-07-05 10:43:04 308

原创 网络层(二)ARP协议

ARP协议一.概述       简单地来说,ARP协议就是地址解析协议。对于以太网,数据链路层上是根据48bit的以太网地址来确定目的接口,设备驱动程序从不检查IP数据报中的目的IP地址。ARP协议为IP地址到对应的硬件地址之间提供动态映射。        以太网环境下,同一个网段的主机之间需要互相知道对方的MAC地址,才能访问。TCP/IP协议栈从上层到下层的封装过程中,第三层封装需要知道目的I

2017-07-04 17:52:25 3939 1

原创 网络层(一)概述

网络层概述一.前言       网络层是网络体系结构中非常重要的一层,在技术上又是非常复杂的一层。网络层是从功能上定义的一个逻辑层次,与物理层和数据链路层有具体的设备支持一样,网络层也有具体的设备来完成其相关任务,最典型的就是我们常用的路由器(Router)。路由器就相当于连接不同城市公路的中转车站,起数据中转作用。        网络层介于传输层和数据链路层之间,其主要作用是实现两个网络系统之间

2017-06-28 02:03:17 2995

转载 并查集-- PAT - L1-020(并查集应用)

转载自http://blog.csdn.net/qq_28300479/article/details/51586819L1-020. 帅到没朋友时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越

2017-03-23 17:52:43 427

原创 并查集--hdu1272(并查集的应用)

Sum Problem上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走

2017-03-23 16:33:05 429

原创 并查集--hdu1232(基本模板题)

畅通工程 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个城市之间可以有多条道路相通,

2017-03-23 16:24:59 386

转载 并查集基本介绍

转载自https://segmentfault.com/a/1190000004023326概述其实并查集顾名思义就是有“合并集合”和“查找集合”两种操作的关于数据结构的一种算法。性质并查集算法不支持分割一个集合。算法用集合中的某个元素来代表这个集合,该元素称为集合的代表元。一个集合内的所有元素组织成以代表元为根的树形结构。对于每一个元素 parent[

2017-03-23 16:09:05 387

原创 DFS深度优先搜索-- hdu5952(DFS中巧妙建图防超时)

Counting Cliques                                                                      Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Problem Description

2017-03-02 20:05:32 731

转载 尺取基本介绍

转载自http://blog.chinaunix.net/uid-24922718-id-4848418.html有这么一类问题,需要在给的一组数据中找到不大于某一个上限的“最优连续子序列”于是就有了这样一种方法,找这个子序列的过程很像毛毛虫爬行方式比较流行的叫法是“尺取法”。Poj3061给长度为n的数组和一个整数m,求总和不小于m的连续子序列的最小长度

2017-03-02 15:24:35 2923 2

原创 二分--CodeForces - 660C(二分的应用,也可以用尺取)

A - Hard ProcessYou are given an array a with n elements. Each element of a is either 0 or 1.Let's denote the length of the longest subsegment of consecutive elements in a, consistin

2017-03-02 11:56:35 688

原创 模拟--Codeforces 665C(简单模拟)

A - Simple Stringszscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add

2017-03-02 11:38:27 467

原创 DFS深度优先搜索(7)--CodeForces - 767C(深搜DFS应用)

GarlandOnce at New Year Dima had a dream in which he was presented a fairy garland. A garland is a set of lamps, some pairs of which are connected by wires. Dima remembered that each t

2017-02-24 15:42:32 667

原创 最大匹配(1)--poj3041(最大匹配的应用 最大匹配=最小点覆盖数)

A - Asteroids Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which

2017-02-21 21:53:57 567

转载 趣写算法系列之--匈牙利算法

CSDN日报20170219——《程序员的沟通之痛》    【技术直播】揭开人工智能神秘的面纱      程序员1月书讯   云端应用征文大赛,秀绝招,赢无人机!趣写算法系列之--匈牙利算法转载自http://blog.csdn.net/dark_scope/article/details/8880547【书本上的算法往往讲得非常复杂,我和我的朋友计划用一些

2017-02-21 21:42:46 498

转载 匈牙利算法求二分图的最大匹配

匈牙利算法求二分图的最大匹配转载自http://blog.csdn.net/xuguangsoft/article/details/7861988    二分图又称作二部图,是图论中的一种特殊模型。 设G=(V,E)是一个无向图,如果顶点V可分割为两个互不相交的子集(A,B),并且图中的每条边(i,j)所关联的两个顶点i和j分别属于这两个不同的顶点集(i in A,j in B

2017-02-21 21:38:01 494

转载 关于C#中get和set

转载自:http://blog.sina.com.cn/s/blog_82526aa60100txtx.html在程序中经常碰到get、set,不甚明白,在网上查询时也说的迷迷糊糊,所以整理下,以学的明白透彻点。    有两个类person:    public class person    {      public string name;

2017-01-18 17:20:44 366

原创 拓扑排序(1)--hdu2647(拓扑排序邻接表模板 应用判断是否存在环)

Reward                                                       Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionDandelion's uncle is a

2016-12-17 01:27:54 865

原创 拓扑排序基本介绍(拓扑排序邻接矩阵模板)

拓扑排序一.定义    对一个有向无环图(Directed Acyclic Graph简称DAG)G进行拓扑排序,是将G中所有顶点排成一个线性序列,使得图中任意一对顶点u和v,若 ∈E(G),则u在线性序列中出现在v之前。   通常,这样的线性序列称为满足拓扑次序(Topological Order)的序列,简称拓扑序列。   注意:   1)只有有向无环图才存在拓扑序列;

2016-12-17 01:12:24 1332

空空如也

空空如也

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

TA关注的人

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