07 2015 档案
摘要:设计模式总结 设计模式(Design Patterns)是可复用面向对象软件的基础,是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码,让代码更容易被他人理解、保证代码可靠性。 毫无疑问,设计模式于己于他人于系统都是多赢的,设计模式使代码编制真正工程化,
阅读全文
摘要:组合模式(Composite Pattern)组合模式,将对象组合成树形结构以表示“部分-整体”的层次结构,组合模式使得用户对单个对象和组合对象的使用具有一致性。有时候又叫做部分-整体模式,它使我们树型结构的问题中,模糊了简单元素和复杂元素的概念,客户程序可以像处理简单元素一样来处理复杂元素,从而...
阅读全文
摘要:Description:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element fro...
阅读全文
摘要:Description:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 ...
阅读全文
摘要:Description:Write a SQL query to find all numbers that appear at least three times consecutively.+----+-----+| Id | Num |+----+-----+| 1 | 1 || 2 ...
阅读全文
摘要:Description:Given an integer, write a function to determine if it is a power of two.public class Solution { public boolean isPowerOfTwo(int n) { ...
阅读全文
摘要:Description:Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / ...
阅读全文
摘要:Description:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), th...
阅读全文