奔跑的小河
Talk is cheap. Show me the code.

导航

 

2015年4月26日

摘要: 题目:Follow up for ”Search in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and wh... 阅读全文
posted @ 2015-04-26 17:40 奔跑的小河 阅读(120) 评论(0) 推荐(0) 编辑
 
摘要: 题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). ... 阅读全文
posted @ 2015-04-26 17:18 奔跑的小河 阅读(106) 评论(0) 推荐(0) 编辑
 

2015年4月10日

摘要: 单例模式(Singleton Pattern):这种模式涉及到一个单一的类,该类负责创建自己的对象,同时确保只有单个对象被创建。这个类提供了一种访问其唯一的对象的方式,可以直接访问,不需要实例化该类的对象。 主要解决:解决一个全局使用的类,频繁地创建和销毁 缺点:没有接口,不能继承 使用场景:... 阅读全文
posted @ 2015-04-10 19:40 奔跑的小河 阅读(175) 评论(0) 推荐(0) 编辑
 
摘要: 抽象工厂模式(Abstract Factory Pattern):是围绕一个超级工厂创建其他工厂。该超级工厂又称为其他工厂的工厂。在抽象工厂模式中,接口是负责创建一个相关对象的工厂,不需要显式指定它们的类。每个生成的工厂都能按照工厂模式提供对象。 意图:提供一个创建一系列相关或相互依赖对象的接口... 阅读全文
posted @ 2015-04-10 19:33 奔跑的小河 阅读(226) 评论(0) 推荐(0) 编辑
 
摘要: 工厂模式(Factory Pattern):这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。它定义一个创建对象的接口,让其子类自己决定实例化哪一个工厂类,工厂模式使其创建过程延迟到子类进行。 主要解决:主要解决接口选择的问题。 何时使用:我们明确地计划不同条件下创建不同实例时... 阅读全文
posted @ 2015-04-10 19:26 奔跑的小河 阅读(258) 评论(0) 推荐(0) 编辑
 
摘要: 1.类的构造函数可以被声明为explicit,这可阻止它们被用来执行隐式类型转换(implicit type conversions),但是它们仍可被用来进行显式类型转换(explicit type conversions) class A{public: explicit A();} 2... 阅读全文
posted @ 2015-04-10 19:13 奔跑的小河 阅读(152) 评论(0) 推荐(0) 编辑
 

2015年4月7日

摘要: 题目:Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3], ... 阅读全文
posted @ 2015-04-07 21:04 奔跑的小河 阅读(233) 评论(0) 推荐(0) 编辑
 

2015年4月6日

摘要: 前言:对于一致性哈希已经不是罕见概念,在此只是对原有理论概念的一个整理和用自己的理解讲述,希望对新手有些许帮助,利人利己足矣。 1.概念 一致哈希是一种特殊的哈希算法。在使用一致哈希算法后,哈希表槽位数(大小)的改变平均只需要对 K/n 个关键字重新映射,其中 K是关键字的数量,n是槽位数量。然而在 阅读全文
posted @ 2015-04-06 17:37 奔跑的小河 阅读(352) 评论(0) 推荐(0) 编辑
 
摘要: 描述 1.Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. 2.Do not allocate extra... 阅读全文
posted @ 2015-04-06 17:17 奔跑的小河 阅读(120) 评论(0) 推荐(0) 编辑
 

2015年3月30日

摘要: 作为一个C++菜鸟,我将我这半年学习C++的一点小心得分享出来。这些都是零散的一些,一条条地看就可以。 1.C++/CLI是ISO/ANSI C++的扩展。同时visual C++可以开发这两种不同的C++程序。 C++/CLI:扩充版本定义的,在CLR中运行的程序。又叫做CLR程序。 IS... 阅读全文
posted @ 2015-03-30 21:48 奔跑的小河 阅读(120) 评论(0) 推荐(0) 编辑