Design and implement a data structure for Least
Recently Used (LRU) cache. It should support the following
operations:getandset.get(key)- Get the valu...
分类:
其他好文 时间:
2014-05-23 09:59:05
阅读次数:
257
leetcode上刷题。碰到一题实现LRU算法的题目。LRU,Least recently
used。是一种常见的cache和页面替换算法。算法和原理可以参阅相关wiki。leetcode上的这一题,时间要求很苛刻,如果达不到O(1)复杂度的话,基本上会TLE。所以,这一题如果用C++来解的话,需要...
分类:
编程语言 时间:
2014-05-22 03:34:16
阅读次数:
353
Spring不但支持自己定义的@Autowired注解,还支持几个由JSR-250规范定义的注解,它们分别是@Resource、@PostConstruct以及@PreDestroy。
@Resource的作用相当于@Autowired,只不过@Autowired按byType自动注入,而@Res....
分类:
编程语言 时间:
2014-05-22 03:22:42
阅读次数:
228
Spring2.5 中除了提供 @Component
注释外,还定义了几个拥有特殊语义的注释,它们分别是:@Repository、@Service 和 @Controller。在目前的Spring版本中,这 3
个注释和 @Component 是等效的,但是从注释类的命名上,很容易看出这 3 个注释...
分类:
编程语言 时间:
2014-05-22 01:39:14
阅读次数:
322
基于注释(Annotation)的配置有越来越流行的趋势,Spring 2.5
顺应这种趋势,提供了完全基于注释配置 Bean、装配 Bean 的功能,您可以使用基于注释的 Spring IoC 替换原来基于 XML
的配置。本文通过实例详细讲述了 Spring 2.5 基于注释 IoC 功能的使用...
分类:
编程语言 时间:
2014-05-21 23:52:49
阅读次数:
513
ThinkPHP的核心采用的框架模式是CBD,也就是核心Core+行为Behavior+驱动Driver,核心也就是整个框架模式的核心,大部分都是一些基类,去规定规则,Behavior是行为,就是在指定的地方调用来完成一些特定的行为功能,而Driver驱动就类似cache缓存驱动,mysqldb数据库驱动等,完成功能行为..
分类:
Web程序 时间:
2014-05-20 22:45:40
阅读次数:
456
yuminstallbind*一、修改下面配置文件vi/etc/named.confoptions{listen-onport53{192.168.100.210;};listen-on-v6port53{::1;};directory"/var/named";dump-file"/var/named/data/cache_dump.db";statistics-file"/var/named/data/named_stats.txt";memstatistics-file"/var/na..
分类:
其他好文 时间:
2014-05-20 22:07:44
阅读次数:
341
Spring集成spymemcachedMemcached的安装部署我就不介绍了!首先下载spymemcached,下载地址:jar:https://spymemcached.googlecode.com/files/spymemcached-2.10.3.jarjavadoc:https://spymemcached.googlecode.com/files/spymemcached-2.10.3-javadoc.jar源码:https://spymem..
分类:
编程语言 时间:
2014-05-20 21:59:40
阅读次数:
415
编程题:枚举变量作为循环控制变量#include<stdio.h>voidmain(){enumseason{spring=1,summer,autumn,winter}s;for(s=spring;s<=winter;s++) printf("%d\n",s);}
分类:
其他好文 时间:
2014-05-20 21:27:05
阅读次数:
357
编程题:为枚举类型变量赋值。将整型值强制类型转换成枚举类型赋值#include<stdio.h>voidmain(){enumseason{spring,summer,autumn,winter}s1,s2;s1=summer;s2=(enumseason)2;printf("s1=%d,s2=%d\n",s1,s2);}
分类:
其他好文 时间:
2014-05-20 17:51:10
阅读次数:
224