算法:1.
对root的左子树做处理,让左子树的根节点作为,根节点的右子树,并让右子树作为左子树根节点的右子树的子树2. 递归遍历右子树public void
flatten(TreeNode root) { if(root==null){ return; ...
分类:
其他好文 时间:
2014-05-26 23:39:49
阅读次数:
253
Problem 1: Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multip...
分类:
其他好文 时间:
2014-05-23 01:43:01
阅读次数:
253
介绍一个list滑动时通过一个text提示Array首字母位置的应用
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file exce...
分类:
其他好文 时间:
2014-05-23 00:58:42
阅读次数:
326
介绍一个多选list
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with th...
分类:
其他好文 时间:
2014-05-23 00:52:57
阅读次数:
455
介绍自定一个的Adapter和list的监听
注意
1....
分类:
其他好文 时间:
2014-05-23 00:51:45
阅读次数:
355
介绍通过方法
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
return !mStrings[position].startsWith("-");
}
设置list的可以选和不可选注意有...
分类:
其他好文 时间:
2014-05-22 23:08:09
阅读次数:
388
很和谐精悍的一行快排代码quicksort1。
import random
def quicksort( list ):
if list == []:
return []
else:
cut = list[0]
lesser = quicksort( [ x for x in list[1:] if x < cut ]...
分类:
其他好文 时间:
2014-05-22 22:33:19
阅读次数:
402
一,redis内存管理介绍
redis是一个基于内存的key-value的数据库,其内存管理是非常重要的,为了屏蔽不同平台之间的差异,以及统计内存占用量等,redis对内存分配函数进行了一层封装,
程序中统一使用zmalloc,zfree一系列函数,其对应的源码在src/zmalloc.h和src/zmalloc.c
两个文件中。
二,redis内存管理源码分析
redis封装是为了...
分类:
其他好文 时间:
2014-05-22 18:57:08
阅读次数:
499
Arrays 数组帮助类
示例程序(JUnit演示)
数组转化为List
@Test
public void testUserArraysChangeArraytoList() {
// 类Arrays
// public static List asList(T... a)
// Returns a fixed-s...
分类:
编程语言 时间:
2014-05-22 18:37:40
阅读次数:
354
引言: Redis是基于内存的数据库,同时也提供了若干持久化的方案,允许用户把内存中的数据,写入本地文件系统,以备下次重启或者当机之后继续使用。本文将描述如何基于Redis来设置这些功能...
分类:
其他好文 时间:
2014-05-22 17:08:44
阅读次数:
316