自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

通往花开的路上

努力学习,天天向上

  • 博客(41)
  • 资源 (5)
  • 收藏
  • 关注

转载 JAVA中关于wait()和sleep()

Java中的多线程是一种抢占式的机制,而不是分时机制。抢占式的机制是有多个线程处于可运行状态,但是只有一个线程在运行。 共同点 : 1. 他们都是在多线程的环境下,都可以在程序的调用处阻塞指定的毫秒数,并返回。 2. wait()和sleep()都可以通过interrupt()方法 打断线程的暂停状态 ,从而使线程立刻抛出InterruptedException。 如果线程A希望立

2015-09-28 16:26:38 813

转载 设计模式之行为型模式

设计模式总结之行为型模式行为型模式设计到算法和对象间的职责分配,不仅描述对象或类的模式,还描述它们之间的通信方式,刻划了运行时难以跟踪的复杂的控制流,它们将你的注意力从控制流转移到对象间的关系上来。行为型类模式采用继承机制在类间分派行为,例如Template Method 和Interpreter;行为对象模式使用对象复合而不是继承。一些行为对象模式描述了一组相互对等的对象如何相互协作

2015-09-28 15:25:35 1223

转载 结构间进程通讯

进程间通信机制1   文件映射  文件映射(Memory-Mapped Files)能使进程把文件内容当作进程地址区间一块内存那样来对待。因此,进程不必使用文件I/O操作,只需简单的指针操作就可读取和修改文件的内容。  Win32 API允许多个进程访问同一文件映射对象,各个进程在它自己的地址空间里接收内存的指针。通过使用这些指针,不同进程就可以读或修改文件的内容,实现

2015-09-28 15:21:22 434

转载 设计模式——结构型模式

设计模式——结构型模式(包含7种)  结构型设计模式是从程序的结构上解决模块之间的耦合问题。包括以下七种模式:1.Adapte适配器模式:Adapter模式通过类的继承或者对象的组合侧重于转换已有的接口,类适配器采用“多继承”的实现方式,带来了不良的高耦合,所以一般不推荐使用。对象适配器采用“对象组合”的方式,更符合松耦合精神。  例如:笔记本 电源适配器,可以将220

2015-09-28 15:19:24 251

原创 leetcode:Interleaving String 使用动态规划求解的java源代码

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", r

2015-09-28 14:24:12 481

原创 leetcode:Longest Valid Parentheses 使用动态规划O(n)思路

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",

2015-09-27 17:08:29 922

原创 leetcode 222:Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely fille

2015-09-26 23:12:55 347

原创 Binary Tree Maximum Path Sum

递归求解二叉树的最大路径问题

2015-09-26 15:51:35 351

原创 leetcode 239:Sliding Window Maximum

使用linkedList快速地获得一定窗口中的最大元素

2015-09-26 11:30:41 475

原创 leetcode:Sort List 使用归并排序的解决思路

使用归并排序对链表进行排序

2015-09-26 09:55:40 630

原创 leetcode 229:Majority Element II

根据摩尔投票解决majority问题

2015-09-25 15:48:55 571

原创 leetcode 179:Largest Rectangle in Histogram 两种算法

Largest Rectangle 使用一般算法和贪心算法进行实现的两种思路分析以及相关代码

2015-09-25 10:35:13 273

原创 leetcode 241:Different Ways to Add Parentheses

递归计算字符串算术表达式

2015-09-24 14:36:58 582

原创 leetcode:Kth Largest Element in an Array 使用快速选择算法,以及对其复杂度的分析

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5

2015-09-23 14:56:24 1111

原创 leetcode279:Perfect Squares

使用动态规划解决离散背包问题

2015-09-22 15:33:49 442

原创 leetcode:Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Ensure that numbers wi

2015-09-21 00:18:07 299

原创 leetcode:Reverse Linked List

题目分析:把链表反过来,找一个list存链表,逆序遍历建立关系即可。具体代码如下:public ListNode reverseList(ListNode head) { if(head==null) return null; List list=new ArrayList(); ListNode p=head; //存储链表 while(p!=null)

2015-09-20 22:33:31 274

转载 leetcode 238:Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O

2015-09-18 14:18:59 262

原创 leetcode:Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2015-09-18 10:42:25 285

原创 leetcode130:Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O XX X

2015-09-17 20:29:46 279

原创 leetcode:151Reverse Words in a String java实现

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".题目分析:太简单了,要注意一点 split可能会返回空串 public String reverseWords(String s) {

2015-09-17 19:15:57 473

转载 leetcode:Wildcard Matching

Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t

2015-09-17 17:35:58 394

原创 leetcode:Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i an

2015-09-17 10:12:42 378

转载 排序二叉树,平衡二叉树和红黑树的概念以及相关的操作讲解

排序二叉树,平衡二叉树,红黑树

2015-09-17 09:27:19 1183

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

2015-09-16 16:07:09 329

原创 leetcode: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:Elements in a triplet (a,b,c

2015-09-14 22:43:57 223

原创 leetcode:TwoSum

Leetcode 对于TwoSun题目的分析,以及用hashmap巧妙求解,代码为java实现

2015-09-12 20:32:46 307

原创 leetcode:Minimum Window Substring 细致分析

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN

2015-09-10 15:12:31 432

原创 leetcode:Basic Calculator II

leetcode 简易计算器的实现

2015-09-09 21:01:46 266

原创 leetcode:ugly Number II

Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first

2015-09-08 14:55:26 241

原创 leetcode:Substring with Concatenation of All Words

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in wordsexactly once and w

2015-09-07 15:37:39 418

转载 JAVA包装类

Java共有六个包装类,分别是Boolean、Character、Integer、Long、Float和Double,从字面上我们就能够看出他们分别对应于 boolean、char、int、long、float和double。

2015-09-06 21:57:32 343

转载 Struct1和Struct2的区别

http://www.nowcoder.com/test/question/done?tid=1196688&qid=15081#summary

2015-09-06 21:51:51 2817

转载 Java父类子类成员变量初始化

初始化过程是这样的: 1.首先,初始化父类中的静态成员变量和静态代码块,按照在程序中出现的顺序初始化; 2.然后,初始化子类中的静态成员变量和静态代码块,按照在程序中出现的顺序初始化; 3.其次,初始化父类的普通成员变量和代码块,在执行父类的构造方法;4.最后,初始化子类的普通成员变量和代码块,在执行子类的构造方法;

2015-09-06 21:48:37 1748

原创 类成员变量访问权限

public 所有类private 自己protect 同一包和子类什么都不写 只能被同一包访问

2015-09-06 21:03:48 543

转载 结构型模式

结构型模式是描述如何将类对象结合在一起,形成一个更大的结构,结构模式描述两种不同的东西:类与类的实例。故可以分为类结构模式和对象结构模式。在GoF设计模式中,结构型模式有:1.适配器模式 Adapter  适配器模式是将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。  两个成熟的类需要通信,但是接口不同

2015-09-06 20:58:37 321

转载 Java中List删除

Iterator it = list.iterator();intindex = 0;while(it.hasNext()){    Object obj = it.next();    if(needDelete(obj))  //needDelete返回boolean,决定是否要删除    {     

2015-09-06 20:54:16 578

转载 HashMap&HashTable

以下内容均转自百度百科:     HashMap: 基于哈希表的 Map 接口的实现。此实现提供所有可选的映射操作,并允许使用 null 值和 null 键。(除了非同步和允许使用 null 之外,HashMap 类与 Hashtable 大致相同。)此类不保证映射的顺序,特别是它不保证该顺序恒久不变。 此实现假定哈希函数将元素适当地分布在各桶之间,可为基本操作(get 和 put)提

2015-09-06 20:45:58 358

原创 关于JAVA中if表达式中的赋值语句

例一:public static void main(){boolean x=false;if(x=true){System.out.print(x);}}注意:这是编译可以通过的,会打印出true;例二:public static void main(){int x=0;if(x=1){System.out.print(x);}

2015-09-06 20:36:33 8777

原创 leetcode:Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it t

2015-09-06 20:21:15 413

互联网2016各岗位面试合集

包括互联网公司的各种面试经验

2016-03-16

Netty in Action 第5版 中英文都要

Netty in Action 第5版.JAVA NIO。中文版英文版都有

2016-03-16

SQLserverg各种查询语句

SQL各种查询语句,SELECT源代码,里面包含老师所讲的各种案例

2013-06-03

SQLserver 2008 安装 创建表 删除表 等基本操作

SQLserver 2008 安装 创建表 删除表 等基本操作,实验报告,每步都有截图,还有源码,很完整

2013-05-30

空空如也

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

TA关注的人

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