Sort a linked list in O(n log n) time using constant space complexity.解题思路:归并排序、快速排序、堆排序都是O(n log n),由于优先级队列是用堆排序实现的,因此,我们使用优先级队列即可,JAVA实现如下: publi...
分类:
编程语言 时间:
2015-06-05 00:24:17
阅读次数:
150
上几张图常量池(constant
pool)指的是在编译期被确定,并被保存在已编译的.class文件中的一些数据。它包括了关于类、方法、接口等中的常量,也包括字符串常量。String.intern():存在于.class文件中的常量池,在运行期被JVM装载,并且可以扩充。String的intern()方法就是扩充常..
分类:
其他好文 时间:
2015-06-04 06:26:34
阅读次数:
188
写程序的时候经常需要调试,下面给出静态和动态断言调试以及常用的内置宏。
内置宏:
__FILE__//输出文件名
__LINE__//所在行
__DATE__//日期
__TIME__//时间
__FUNCTION__//函数名
static_assert(
constant-expression,
string-literal
);
静态断言是...
分类:
其他好文 时间:
2015-06-03 21:43:06
阅读次数:
122
template > class list; ListLists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iterat...
分类:
其他好文 时间:
2015-06-03 19:28:03
阅读次数:
125
Druid是阿里开发的数据库连接池,据说比c3p0性能更好,支持下国产。下面就来学习下超简单的连接池配置:
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="clos...
分类:
其他好文 时间:
2015-06-03 11:56:21
阅读次数:
136
mysql可以用mariadb替代先前在51cto博客看到一位老师写了七版本的部署方案,写的很赞,已经收藏。yuminstallntp-yvi/etc/ntp.conf#server0.centos.pool.ntp.orgiburst#server1.centos.pool.ntp.orgiburst#server2.centos.pool.ntp.orgiburst#server3.centos.pool.ntp.orgiburst..
分类:
数据库 时间:
2015-06-03 10:06:34
阅读次数:
178
如果一个对象的生命周期显而易见,很容易就知道什么时候该new一个对象,什么时候不再需要使用,这种情况下,直接用手动的retain和release来判定其生死足矣。但是有些时候,想知道某个对象在什么时候不再使用并不那么容易。如果下面的代码,看上去非常简单:Sample.h类接口部分#import @i...
分类:
其他好文 时间:
2015-06-02 00:18:31
阅读次数:
195
一、struts中的常量constant的配置,在struts2中同一个常量的配置有三种方式,第一种在struts.xml中,第二种在struts.properties中配置,第三种在web.xml中配置。以配置struts2为开发模式为例:1.在struts.xml中配置2.在struts.pro...
分类:
其他好文 时间:
2015-06-01 22:18:43
阅读次数:
122
Error occurred during initialization of VMjava.lang.ClassFormatError: Unknown constant tag 26 in class file sun/jkernel/DownloadManager at java.lang.C...
分类:
编程语言 时间:
2015-06-01 16:07:22
阅读次数:
121
内存管理一直是学习 Objective-C 的重点和难点之一,尽管现在已经是 ARC 时代了,但是了解 Objective-C 的内存管理机制仍然是十分必要的。其中,弄清楚 autorelease 的原理更是重中之重,只有理解了 autorelease 的原理,我们才算是真正了解了 Objective-C 的内存管理机制。注:本文使用的 runtime 源码是当前的最新版本 objc4-646.t...
分类:
其他好文 时间:
2015-06-01 11:31:28
阅读次数:
117