数组
1) 概述
定义
在计算机科学中,数组是由一组元素(值或变量)组成的数据结构,每个元素有至少一个索引或键来标识
In computer science, an array is a data structure...答:链表不行,因为链表的元素并非相邻存储
5) 越界检查
java 中对数组元素的读写都有越界检查,类似于下面的代码
bool is_within_bounds(int index) const...{
return 0 <= index && index < length();
}
代码位置:openjdk\src\hotspot\share\oops\arrayOop.hpp
只不过此检查代码...1,2,4,5,6]){
// 拷贝10,11
}
}
}
}
}
}
代码...int[] a1 = {1, 5, 6, 2, 4, 10, 11};
int[] a2 = new int[a1.length];
merge(a1, 0, 2, 3, 6, a2, 0);
方法2
代码