自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 MySQL学习笔记----子查询、联结表、组合查询、全文本搜索

联结:一种机制,用来在一条SELECT语句中关联表,因此称之为联结。它在数据库中不存在。联结由MySQL根据需要建立,它存在于查询的执行过程中。创建联结:(使用WHERE联结)SELECT vend_name, prod_name, prod_priceFROM vendors, productsWHERE vendors.vend_id = pr...

2016-04-21 22:17:00 430

转载 LeetCode之24----Swap Nodes in Pairs

题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algorit...

2016-04-21 19:08:00 209

转载 LeetCode之23---Merge k Sorted Lists

题目:  Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目大意:  给定k条有序链表,求k条链表有序合并后的链表。思路:  看到这道题感觉蛮亲切的,因为已经不止一次遇到链表有序合并的问题了,所以思路还是...

2016-04-20 23:43:00 200

转载 LeetCode之22----Generate Parentheses

题目:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()...

2016-04-20 19:57:00 117

转载 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.题目大意:  给定两个有序的链表,求有序合并后的链表。思路: ...

2016-04-17 16:59:00 99

转载 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"()...

2016-04-16 22:47:00 114

转载 LeetCode之19---Remove Nth Node From End of List

题目:Given a linked list, remove thenthnode 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...

2016-04-16 14:33:00 136

转载 LeetCode之18---4Sum

题目:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of target....

2016-04-16 00:00:00 101

转载 MySQL学习笔记---基础概念和一些基础SQL语句(一)

MySQL学习笔记,以防遗忘数据库基本概念数据库:保存有组织的数据的容器(通常是一个文件或一组文件)。表:某种特定类型数据的结构化清单,数据库中的表都有一个唯一的名字用来标识自己。模式:关于数据库和表的布局及特性的信息。列:表中的一个字段。所有表都是由一个或多个列组成,每个列都有对应的数据类型。行:表中的一个记录。主键:一列(或一组列),其值能够唯一区...

2016-04-14 20:11:00 441

转载 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....

2016-04-14 18:46:00 88

转载 三角形数字问题

题目:  给定一个数字三角形,找到从顶部到底部的最大路径和。每一步可以移动到下面一行的相邻数字上。输入第一行数字n是三角形的行数,接下来的n行是数字三角形的每一行,如:   5   7   3 8   8 1 0   2 7 4 4   4 5 2 6 5  输出是 30思路:  1、递归+记忆法   用二维数组存储数字三角形中的每一行...

2016-04-13 17:06:00 232

转载 LeetCode之16----3Sums Closest

题目:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input ...

2016-04-12 19:14:00 113

转载 LeetCode之15----3Sum

题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements i...

2016-04-11 22:00:00 94

转载 字典序问题

题目:  字典序问题,给定一个长度不超过6的小写字母升序字符串(字符串中的字符相对顺序和字母表中的顺序一致),迅速计算出在字典中的编码,字典如: 1 2 3 ... 26 27 28 ... a b c ... z ab ac ...思路: 总体思路为先计算出给定字符串前所有的个数...

2016-04-10 23:03:00 181

转载 LeetCode之14---Longest Common Prefix

题目:  Write a function to find the longest common prefix string amongst an array of strings.题目大意:   写一个函数,求一个字符串数组中最长的公共前缀子串。思路:  在做这道题之前先要了解一下什么叫做公共前缀子串。在英语中一个单词可以分为前缀、词根、后缀三部分,所谓前...

2016-04-10 14:21:00 131

转载 LeetCode之13---Roman to Integer

题目:  Given a roman numeral, convert it to an integer.  Input is guaranteed to be within the range from 1 to 3999.题目大意:  给定一个罗马数字,将其转化为一个整数。转化好的整数的范围在1---3999之间。思路:  有了上一题的经验,我们可...

2016-04-09 19:42:00 121

转载 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.题目大意:  输入一个整形数字,将其转化为罗马数字,范围在1--3999之间。思路:  在做此题之前特意谷歌了一下罗马数字是什么...

2016-04-09 15:49:00 109

转载 LeetCode之11---Container With Most Water

题目:  Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,a...

2016-04-08 18:00:00 82

转载 LeetCode之10 --- Regular Expression Matching

题目:  ,Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cove...

2016-04-07 20:22:00 74

转载 LeetCode之9---Palindrome Number

题目:  Determine whether an integer is a palindrome. Do this without extra space.题目大意:  判断一个数字是不是回文数,要求不是用额外的空间。思路:  最近的几道LeetCode的题很简单,答题思路就是将原数字翻转然后和原数相比较,如果相等则返回true,否则返回false。但是以前...

2016-04-05 22:02:00 85

转载 LeetCode之8----String to Integer (atoi)

题目:  Implementatoito convert a string to an integer.题目大意:  将一个数字字符串转化为整数数字,返回整数数字。思路:  初看本题觉得很简单,直接用一个循环进行转换就行了,循环里边的语句也很简单,就是result = result * 10 + s[i] - '0',但是提交之后就轰轰烈烈的错了。原来...

2016-04-05 19:53:00 137

转载 LeetCode之7 --- Reverse Integer

题目:  Reverse digits of an integer.  Example1:x = 123, return 321  Example2:x = -123, return -321题目大意:逆置一个整数,如:123--->321 -123--->-321思路:  这道题比较简单,和回文数的解法一致,只不过比回文数少了一个...

2016-04-04 18:41:00 75

转载 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 ...

2016-04-04 15:19:00 97

转载 LeetCode 之 5 ---- Longest Palindromic Substring

题目:  Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest palindromic substring....

2016-04-03 21:14:00 86

转载 LeetCode之4---Median of Two Sorted Arrays

题目:  There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).大意:...

2016-03-31 23:53:00 90

转载 LeetCode之300—-Longest Increasing Subsequence

题目:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given[10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is[2, ...

2016-03-30 19:03:00 103

转载 数组中位数

题目:将两个等长有序数组的中位数,要求时间复杂度为O(logn)。思路:大体思想是:比较两个数组的中位数(1)、如果相同则该值就是中位数(2)、如果num1<num2则中位数位于num1的后半部分或num2的前半部分(3)、如果num1>num2则中位数位于num1的前半部分或num2的后半部分...

2016-03-29 22:08:00 343

转载 链表中一些有趣的小题目总结

1、单链表中间结点问:如何快速查找定位到一条单链表的中间结点?答:(1)、可以将链表中的所有结点遍历一遍得到总个数,再查找到中间结点(这不废话嘛,这么low的答案就不拉出来献丑了=、=)(2)、可以使用快慢指针法,一个指针一倍速率遍历,另一个指针两倍速率遍历链表,当第一个走到末尾时第二个则刚好在中间位置代码:NODE *Search(NOD...

2016-03-28 23:45:00 139

转载 LeetCode之3---Longest Substring Without Repeating Characters

题目: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the ...

2016-03-28 23:32:00 56

转载 LeetCode之2— Add Two Numbers

题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r...

2016-03-27 15:55:00 57

转载 TCP/IP初探

目前互联网上使用的主流协议族就是TCP/IP协议族,它是一个分层、多协议的通信体系。TCP/IP协议族是一个四层协议系统,自低向上分别是数据链路层、网络层、传输层和应用层。下层协议为上层协议提供服务。数据链路层:实现了网卡接口的网络驱动程序,以处理数据在物理媒介上的传输,数据链路层的相关协议隐藏了不同物理网络上的不同电气特性,为上层协议提供了...

2016-03-27 15:11:00 114

转载 LeetCode之1—-Two Sum

题目:Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution....

2016-03-27 15:08:00 66

转载 LeetCode之338—-Counting Bits

最近上算法课上的有点心塞,所以感觉应该刷刷题来见见世面了,所以选择了LeetCode来做一点题目。LeetCode之338:Given a non negative integer numbernum. For every numbersiin the range0 ≤ i ≤ numcalculate the number of 1’s in thei...

2016-03-26 15:31:00 89

转载 中缀表达式求值

所谓表达式的求值就是从键盘上输入一个四则运算表达式按下Enter后在屏幕上输出表达式的结果。表达式的求值在计算机的应用中非常广泛,例如编译器中对所写的程序表达式的编译等。它也是数据结构课程中栈这一章节中非常重要的一个算法,通过实现这个算法可以更好的掌握和理解栈的相关操作。中缀表达式是指运算符在运算数的中间,计算中缀表达式时需要用到两个栈:数字栈和运算符栈。在整个中缀表...

2016-03-26 13:24:00 1017

转载 图算法之最小生成树(Kruskal)

所谓最小生成树是指:给定一个无向图G={V,E},用集合{u,v}∈E表示从u到v的边,w(u,v)表示从u到v的权值,若{u,v}集合中所有元素权值之和最小且没有构成回路,则称集合{u,v}为该图的最小生成树。举个例子,如下图所示的连通图中,其中的一个最小生成树为边:(A,C)、(A,D)、(D,B)、(D,F)、(B,E)、(E、G)组成的树。最小生成树在...

2016-03-26 13:15:00 211

转载 递归与非递归实现走迷宫算法

●问题描述:  给出一个矩阵,其中0表示通路,1表示墙壁,这样就形成了一个迷宫,要求编写算法求出其中一条路径。●递归思路:  编写一个走迷宫函数,传入二位数组的下标,先假设该点位于最终路径上(将0置为2)再探测周围四个点是否可以走通(是否为0),如果可以走通则将该点四周能走通的点作为函数参数传入函数进入递归。若四周均不能走通(都不为0时)则将该点置回0表示该点不是...

2015-10-09 20:48:00 846

转载 用链表实现一元多项式的加、减、乘、求导运算

  在数据结构线性表的链表学习中有一个很有趣的题目:计算两个多项式的加、减、乘和多项式的导数。  题目不难,将多项式的系数和指数存进链表,然后进行相应操作即可。  一、加法:    1、判断指数是否相等,若相等则将系数相加,相加后不为零就开辟新空间,将新的系数存入结点,尾插进新链表中。    2、如果表达式1的指数小于表达式2的指数,就将表达式1的该结点数据复制进...

2015-09-09 15:27:00 1709

转载 select函数总结

一、select函数的作用 select函数是一个I/O多路复用函数。所谓多路复用比较官方的定义是内核一旦发现进程指定的一个或者多个IO条件准备读取,它就通知该进程。比如电脑的键盘和显示器,如果一直阻塞在键盘上等待键盘输入那么如果这时候显示器上来了信息怎么办?岂不是不能正常显示!I/O复用就是将键盘和显示器监控起来,如果键盘上来了消息内核就会通知去处...

2015-08-16 16:02:00 253

转载 网络编程学习总结(之client/server模型)

一、什么是client/server模型 client/server翻译过来是客户端/服务器的意思,该模型最基础的表现方式是客户端连接上服务器后向服务器发送相应请求由服务器处理完成后做出相应动作。通过它可以充分利用两端硬件环境的优势,将任务合理分配到Client端和Server端来实现,降低了系统的通讯开销。二、client/server模型服务器端实...

2015-08-08 21:22:00 654

转载 linux 网络编程总结(之网络编程函数总结)

这周学习了linux网络编程相关的知识,现在将其总结如下: 在linux系统中已经将TCP/IP协议相关的东西都封装好了,所以在入门学习网络编程的时候并没有学习研究太多TCP/IP协议的东西,而是学习那些已经将协议封装好的函数和API。 在linux网络编程中基本几个函数如下: 第一个函数:...

2015-08-07 21:48:00 175

空空如也

空空如也

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

TA关注的人

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