JasonChang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

12 2013 档案

摘要:1 public class Solution { 2 public ArrayList> threeSum(int[] num) { 3 if(num == null) 4 return null; 5 6 Arrays.sort(num); 7 HashSet> set = new HashSet>(); 8 9 for(int i = 0; i tmp = new ArrayList();17 tmp.add(nu... 阅读全文
posted @ 2013-12-24 06:24 JasonChang 阅读(177) 评论(0) 推荐(0) 编辑

摘要:Visitor:Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. 阅读全文
posted @ 2013-12-04 16:30 JasonChang 阅读(161) 评论(0) 推荐(0) 编辑

摘要:Memento:Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. 阅读全文
posted @ 2013-12-04 16:13 JasonChang 阅读(90) 评论(0) 推荐(0) 编辑

摘要:Mediator:Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. 阅读全文
posted @ 2013-12-04 16:11 JasonChang 阅读(136) 评论(0) 推荐(0) 编辑

摘要:Interpreter:Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. 阅读全文
posted @ 2013-12-04 16:08 JasonChang 阅读(140) 评论(0) 推荐(0) 编辑

摘要:Prototype: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. 阅读全文
posted @ 2013-12-04 15:38 JasonChang 阅读(108) 评论(0) 推荐(0) 编辑

摘要:Builder:Separate the construction of a complex object from its representation so that the same construction process can create different representations. 阅读全文
posted @ 2013-12-04 15:05 JasonChang 阅读(105) 评论(0) 推荐(0) 编辑

摘要:Chain of Responsibility:Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. 阅读全文
posted @ 2013-12-04 15:01 JasonChang 阅读(155) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2013-12-04 14:34 JasonChang 阅读(166) 评论(0) 推荐(0) 编辑

摘要:Flyweight:Use sharing to support large numbers of fine-grained objects efficiently. 阅读全文
posted @ 2013-12-04 14:31 JasonChang 阅读(117) 评论(0) 推荐(0) 编辑

摘要:The Bridge Pattern:Decouple an abstraction from its implementation so that the two can vary independently. 阅读全文
posted @ 2013-12-04 14:17 JasonChang 阅读(80) 评论(0) 推荐(0) 编辑

摘要:The Proxy Patternprovides a surrogate or placeholder for another object to control access to it. 阅读全文
posted @ 2013-12-04 13:28 JasonChang 阅读(107) 评论(0) 推荐(0) 编辑

摘要:The State Patternallows an object to alter its behavior when its internal state changes. The object will appear to change its class. 阅读全文
posted @ 2013-12-04 12:33 JasonChang 阅读(105) 评论(0) 推荐(0) 编辑

摘要:The Composite Patternallows you to compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. 阅读全文
posted @ 2013-12-04 10:31 JasonChang 阅读(142) 评论(0) 推荐(0) 编辑

摘要:The Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. 阅读全文
posted @ 2013-12-04 10:11 JasonChang 阅读(124) 评论(0) 推荐(0) 编辑

摘要:The Template Method Patterndefines the skeleton of an algorithm in a method, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure. 阅读全文
posted @ 2013-12-03 15:56 JasonChang 阅读(95) 评论(0) 推荐(0) 编辑

摘要:The Facade Patternprovides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use. 阅读全文
posted @ 2013-12-03 14:49 JasonChang 阅读(95) 评论(0) 推荐(0) 编辑

摘要:The Adapter Patternconverts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. Object Adapter v.s. Class Adapter 阅读全文
posted @ 2013-12-03 14:20 JasonChang 阅读(108) 评论(0) 推荐(0) 编辑

摘要:The Command Patternencapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations. 阅读全文
posted @ 2013-12-03 10:17 JasonChang 阅读(82) 评论(0) 推荐(0) 编辑

摘要:The Singleton Patternensures a class has only one instance, and provide a global point of access to it. 阅读全文
posted @ 2013-12-02 16:19 JasonChang 阅读(126) 评论(0) 推荐(0) 编辑

摘要:The Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.implementation 阅读全文
posted @ 2013-12-02 15:32 JasonChang 阅读(117) 评论(0) 推荐(0) 编辑

摘要:The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.implementation 阅读全文
posted @ 2013-12-02 13:09 JasonChang 阅读(218) 评论(0) 推荐(0) 编辑

摘要:The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extendingfunctionality.implementation 阅读全文
posted @ 2013-12-02 12:21 JasonChang 阅读(134) 评论(0) 推荐(0) 编辑

摘要:The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. Observer Pattern = Publisher + Subcribersimplemenation: 阅读全文
posted @ 2013-12-02 08:37 JasonChang 阅读(143) 评论(0) 推荐(0) 编辑

摘要:1 /** 2 * Definition for singly-linked list with a random pointer. 3 * class RandomListNode { 4 * int label; 5 * RandomListNode next, random; 6 * RandomListNode(int x) { this.label = x; } 7 * }; 8 */ 9 public class Solution {10 public RandomListNode copyRandomList(RandomListN... 阅读全文
posted @ 2013-12-01 13:18 JasonChang 阅读(347) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示