24.Map接口:
Map接口定义了存储“键(key)-值(value)映射对”的方法,Map
中不能有重复的“键”,Map实现类中储存的”键-值“映射对是通过
键来唯一标识的,Map底层的”键“使用Set来存放的,所以Map
中的映射对的”键”对应的类必须重写hashCode()和equals()方法,
常用String作为Map的“键”。
Map的添加、删除操作...
分类:
编程语言 时间:
2014-05-26 05:47:05
阅读次数:
348
题目:输入一颗二叉树的根结点,判断该二叉树是不是平衡二叉树。平衡二叉树是满足所有结点的左右子树的高度差不超过1的二叉树
方案一:遍历数组的每一个结点,对每一个结点求它的左右子树的高度并进行判断。时间复杂度大于O(n),小于O(n^2)效率较低,因为有很多点需要重复访问。
//二叉树的结点
struct BinaryTreeNode{
int m_value;
Bin...
分类:
其他好文 时间:
2014-05-26 04:34:53
阅读次数:
192
概述
SharedPreferences的使用非常简单,能够轻松的存放数据和读取数据。SharedPreferences只能保存简单类型的数据,例如,String、int等。一般会将复杂类型的数据转换成Base64编码,然后将转换后的数据以字符串的形式保存在 XML文件中,再用SharedPreferences保存。
使用SharedPreferences保存key-value...
分类:
移动开发 时间:
2014-05-25 10:17:01
阅读次数:
275
-----026-upload.php ----- 1 2 3 4 5 上传图片 6 7 8 上传图片
9 10 11 上传图片:12 放在这里:13 14 15 $value) {17 echo $key, "=>", $val...
分类:
Web程序 时间:
2014-05-25 02:26:54
阅读次数:
381
【题目】
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] has the largest sum = 6.
【题意】
给定一个数组,找出和最大的子数组,返回...
分类:
其他好文 时间:
2014-05-24 22:19:17
阅读次数:
260
[Submit][Status][Web
Board]
Description
Student类含有私有数据成员:num,name,sex,公有成员函数: 输入函数get_value()和输出函数display()。采用公用继承方式实现类Student1,增加数据成员:age,addr,成员函数:get_value_1()和display_1()。在程序运行时输入num,n...
分类:
其他好文 时间:
2014-05-24 22:12:09
阅读次数:
309
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:...
分类:
其他好文 时间:
2014-05-24 20:44:39
阅读次数:
221
int -> VALUE INT2NUM
VALUE -> int FIX2INT
char* -> VALUE rb_str_new(char*, len);
VALUE -> char* StringValueCString(value);
转换前..先 用 TYPE(v) 做类型转换
T_FIXNUM int
T_...
分类:
其他好文 时间:
2014-05-24 19:31:34
阅读次数:
214
A bit is a binary digit, taking a logical value of either 1 or 0 (also referred to as "true" or "false" respectively). And every decimal number has a binary representation which is actually a series o...
分类:
其他好文 时间:
2014-05-24 17:19:41
阅读次数:
335
[csharp]view
plaincopy1、要使用Dictionary集合,需要导入C#泛型命名空间
System.Collections.Generic(程序集:mscorlib)2、描述
1)、从一组键(Key)到一组值(Value)的映射,每一个添加项都是由一个值及其相关连的键组成 ...
分类:
其他好文 时间:
2014-05-24 11:53:21
阅读次数:
297