自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 mysql练习2

1.原表:courseid coursename score-------------------------------------1 java 702 oracle 903 xml 404 jsp 305 servlet 80-------------------------------------为了便于阅读, 查询此表后的结果显式如下( 及格分数为6

2017-12-17 20:02:58 341

转载 单例模式浅谈

概念:  java中单例模式是一种常见的设计模式,单例模式的写法有好几种,这里主要介绍三种:懒汉式单例、饿汉式单例、登记式单例。  单例模式有以下特点:  1、单例类只能有一个实例。  2、单例类必须自己创建自己的唯一实例。  3、单例类必须给所有其他对象提供这一实例。  单例模式确保某个类只有一个实例,而且自行实例化并向整个系统提供这个实例。在计算机系统中,线程池、缓存、

2017-12-17 13:33:25 185

转载 mysql练习1

1.用一条SQL 语句 查询出每门课都大于80 分的学生姓名name   kecheng   fenshu张三    语文       81张三     数学       75李四     语文       76李四     数学       90王五     语文       81王五     数学       100王五     英语       90法1:

2017-12-15 19:32:12 368

转载 PreparedStatement

本文讲述了如何正确的使用prepared statements。为什么它可以让你的应用程序运行的更快,和同样的让数据库操作变的更快。  为什么Prepared Statements非常重要?如何正确的使用它? 数据库有着非常艰苦的工作。它们接受来自众多并发的客户端所发出的SQL查询,并尽可能快的执行查询并返回结果。处理statements是一个开销昂贵的操作,不过现在有

2017-11-21 16:48:48 266

转载 try--catch--finally中return返回值执行的顺序

http://www.cnblogs.com/zhangboy/archive/2017/10/09/7643583.html

2017-11-16 23:55:26 202

转载 B树 B+树

转载:http://blog.csdn.net/u013400245/article/details/528247443.B- 树      3.1什么是B-树具体讲解之前,有一点,再次强调下:B-树,即为B树。因为B树的原英文名称为B-tree,而国内很多人喜欢把B-tree译作B-树,其实,这是个非常不好的直译,很容易让人产生误解。如人们可能会以为B-树是一种树,而B树

2017-11-12 12:10:51 193

转载 散列表

转载 http://blog.csdn.net/duan19920101/article/details/51579136什么是哈希表?   哈希表(Hash table,也叫散列表),是根据关键码值(Key value)而直接进行访问的数据结构。也就是说,它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度。这个映射函数叫做散列函数,存放记录的数组叫做散列表。

2017-11-12 11:19:38 161

转载 python编码

中文编码问题是用中文的程序员经常头大的问题,在python下也是如此,那么应该怎么理解和解决python的编码问题呢?我们要知道python内部使用的是unicode编码,而外部却要面对千奇百怪的各种编码,比如作为中国程序经常要面对的gbk,gb2312,utf8等,那这些编码是怎么转换成内部的unicode呢?首先我们先看一下源代码文件中使用字符串的情况。源代码文件作为文本文件就必然是以

2017-08-02 10:21:14 172

原创 Edit Distance(dp)

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:

2017-06-06 20:23:42 186

原创 最大子数组和最大值平均子数组

1.最大子数组给定一个整数数组,找到一个具有最大和的子数组,返回其最大和。样例给出数组[−2,2,−3,4,−1,2,1,−5,3],符合要求的子数组为[4,−1,2,1],其最大和为6法1:贪心 int maxSubArray(vector nums) { // write your code here int sum=nums[

2017-06-03 12:48:21 2352

原创 两个整数相除

将两个整数相除,要求不使用乘法、除法和 mod 运算符。如果溢出,返回 2147483647 。样例给定被除数 = 100 ,除数 = 9,返回 11。1.超时的二分法(里面的求和增加了复杂度):class Solution {public: /** * @param dividend the dividend * @p

2017-06-02 20:15:33 1320

原创 线段树基础

1.线段树的构造线段树是一棵二叉树,他的每个节点包含了两个额外的属性start和end用于表示该节点所代表的区间。start和end都是整数,并按照如下的方式赋值:根节点的 start 和 end 由 build 方法所给出。对于节点 A 的左儿子,有 start=A.left, end=(A.left + A.right) / 2。对于节点 A 的右儿子,有 start=

2017-06-02 13:54:07 185

原创 二分法

1.最长上升子序列给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度。说明最长上升子序列的定义:最长上升子序列问题是在一个无序的给定序列中找到一个尽可能长的由低到高排列的子序列,这种子序列不一定是连续的或者唯一的。https://en.wikipedia.org/wiki/Longest_increasing_subsequence

2017-06-01 11:12:03 264

原创 搜索旋转排序数组

假设有一个排序的按未知的旋转轴旋转的数组(比如,0 1 2 4 5 6 7 可能成为4 5 6 7 0 1 2)。给定一个目标值进行搜索,如果在数组中找到目标值返回数组中的索引位置,否则返回-1。你可以假设数组中不存在重复的元素。样例给出[4, 5, 1, 2, 3]和target=1,返回 2给出[4, 5, 1, 2, 3]和target=0,返回 -1

2017-05-31 23:19:50 212

转载 十大经典排序

一.冒泡排序冒泡排序通过重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来,直到没有再需要交换的元素为止(对n个项目需要O(n^2)的比较次数)。这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端。实现步骤比较相邻的元素。如果第一个比第二个大,就交换他们两个。 对每一对相邻元素做同样的工作,从开始第一对到结

2017-05-28 18:46:32 6839

转载 Largest Number

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve

2017-05-28 12:51:01 225

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

2017-05-28 00:00:23 170

原创 Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers

2017-05-27 23:50:23 252

原创 Copy List with Random Pointer(two pointers)

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.这道题要返回一个新的,但构造和原来链表相同的一个链表每个

2017-05-27 10:25:01 175

原创 又是一道快慢指针与链表的结合题 Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?引用一

2017-05-26 00:47:15 473

原创 链表排序

Sort a linked list in O(n log n) time using constant space complexity.我们可以采用归并排序来解决这个问题/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; *

2017-05-25 22:55:58 239

原创 一道有意思的题目Intersection of Two Linked Lists(双指针)

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: a1 → a2 ↘

2017-05-25 16:57:30 219

原创 Reverse Linked List以及一道有关倒序的题目

Reverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?递归法:/** * Definition for singly-linked list. * struct ListNode {

2017-05-25 09:17:23 683

原创 4sumⅡ

Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such thatA[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same leng

2017-05-23 16:54:41 192

原创 Longest Palindromic Substring

最长回文子序列——leetcode5Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.tag:stringExample:Input: "babad"Output: "bab"Note

2017-05-23 10:16:39 206

原创 3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly

2017-05-22 11:13:44 184

原创 3sum和4sum(two pointers)

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 contain du

2017-05-21 18:21:24 201

原创 int的倒序以及回文

很水的两道题目1.Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Example3:x=2147483647 return 0(溢出则返回0) 就是把一个int类型的数倒着输出 所以这里面存在着溢出的可能性 我们可以使用long long去存

2017-05-21 12:02:48 767

原创 我的第一篇

博客从这里起步  这是我的第一篇博客,现在我已经大二要毕业了才开始写我的博客,我的文笔不太好,我的思维也不是很清晰,我希望用博客来记录我的成长,我的收获,让我的大学不要继续堕落,希望我的人生从这里开始起步。  我的博客主要用来记录我每天的收获,有算法和数据结构(通过做Leetcode和北航oj巩固自己的基础)的思路和方法,还会有我学习ps等技术的体会和感受,在不久的将来也会有准备考研的内容

2017-05-21 10:38:39 208

空空如也

空空如也

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

TA关注的人

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