img

咖啡与代码

咖灰怪’s Blog

“当你发现自己的才华撑不起野心时,就请安静下来学习吧。”
LeetCode刷题之5:Longest Substring Without Repeating Characters(3)
2018-02-07 14:42    学习笔记 数据结构和算法    2178 阅读    0条回复

1. 题目 1.1 英文 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 ...

LeetCode刷题之4:Valid Parentheses(20)
2018-02-06 14:42    学习笔记 数据结构和算法    2196 阅读    0条回复

1. 题目 1.1 英文 Given a string containing just the characters '(' , ')' , '{' , '}' , '[' and ']' , determine if the input string is valid. The brackets mu...

LeetCode刷题之3:Palindrome Number(9)
2018-02-01 17:01    学习笔记 数据结构和算法    2012 阅读    0条回复

1. 题目 1.1 英文 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 s...

LeetCode刷题之2:Reverse Integer(7)
2018-01-25 15:41    学习笔记 数据结构和算法    2225 阅读    0条回复

1. 题目 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing wi...

LeetCode刷题之1:Two Sum(1)
2018-01-24 14:17    学习笔记 数据结构和算法    2097 阅读    0条回复

准备定期刷一刷LeetCode上的题目,并且做一做笔记,这是第一篇。算法实现将采用Go语言。 1. 题目 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...

数据结构的基本概念
2018-01-23 14:43    学习笔记 数据结构和算法    2624 阅读    0条回复

这是一篇数据结构的学习笔记,记录一下一些常见数据结构的概念。 1. 什么是数据结构 数据结构是以某种形式将数据组织在一起的集合,它不仅存储数据,还支持访问和处理数据的操作。 即:数据结构 = 数据存储 + 数据操作 2. 什么是算法 数据结构是数据存储的方式,而算法就是处理数据的方法,数据结构是数据存储的方式,而算法就是处理数据的方法。 3. 时间复杂度和空间复杂度 3.1 时间复杂度 算法的基本...

四种基本排序算法以及PHP实现
2016-10-12 23:42    PHP 数据结构和算法    2227 阅读    0条回复

因为之前没有编程基础,最近才知道排序算法这个概念,原来平时在操作数组的时候是用到“算法”这玩意的。 从网上找了下资料,都一个来源;用$arr=array(1,43,54,62,21,66,32,78,36,76,39); 做例子排序。 1. 冒泡排序 1.1 原理 在要排序的一组数中,对当前还未排好的序列,从前往后对相邻的两个数依次进行比较和调整,让较大的数往下沉,较小的往上冒。即,每当两相邻的数...