字符串匹配,实现c++ strstr()函数 1.蛮力法 2.Robin Karp 具体说明参考维基百科:https://en.wikipedia.org/wiki/Rabin–Karp_algorithm 3.kmp 具体说明参考维基百科:https://en.wikipedia.org/wiki ...
分类:
其他好文 时间:
2016-08-11 00:59:29
阅读次数:
264
题意: Implement regular expression matching with support for '.' and '*'. ...
分类:
其他好文 时间:
2016-08-10 22:42:00
阅读次数:
265
Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to ...
分类:
其他好文 时间:
2016-08-10 19:09:37
阅读次数:
101
Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: By calling next repeatedly until ...
分类:
其他好文 时间:
2016-08-10 12:38:52
阅读次数:
139
Implement pow(x, n). Analyse: Be aware of corner cases. For exmaple, x = 0, n = 0, n = 1, and n < 0. Note the highlited area, if n == INT_MIN, we have ...
分类:
其他好文 时间:
2016-08-10 00:51:29
阅读次数:
133
定义:将抽象和实现解耦,使得两者可以独立地变化
类图:
这个模式比较抽象,个人理解,该模式是通过组合的当时来实现一个大的封装,而不是继承的方式。
代码:
public interface Implement {
public void doSomething();
public void doAnyting();
}public class Con...
分类:
其他好文 时间:
2016-08-09 15:05:26
阅读次数:
136
stristr 如果没有找到该字符串,则返回 false。 它和strstr的使用方法完全一样.唯一的区别是stristr不区分大小写. ...
分类:
Web程序 时间:
2016-08-09 02:11:50
阅读次数:
219
代码: 这道题提醒我一点,要主要修剪多余的计算。 第一个for循环,结束位置是m-n+1 而不是m。 第二个for循环,用break也是避免多余计算。 ...
分类:
其他好文 时间:
2016-08-08 22:36:18
阅读次数:
227
1.定义 将抽象部分与它的实现部分分类,使它们都可以独立地变化 2.结构 Abstraction: 抽象部分的接口。维护一个实现部分对象的引用,抽象对象里面的方法,需要调用实现部分的对象离开完成 RefinedAbstraction: 拓展抽象部分的接口。定义跟实际业务相关的方法 Implement ...
分类:
其他好文 时间:
2016-08-07 21:46:59
阅读次数:
167