文件名称:DArray-better
- 所属分类:
- 压缩解压
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 286kb
- 下载次数:
- 0次
- 提 供 者:
- 陈*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
当数组的元素个数发生变化时,不用重新申请内存空间,数组也能继续使用。这样就提高了效率。
对于机器算法中,“时间”和“空间”的矛盾总是存在的:存储多一点,运行就快些;存储少了,运行就慢些。在这里就体现了,这样处理是用空间换时间。虽然在内存空间上是“浪费”了部分的空间,但是在很长一段时间里,只要空间没有发生变化,运行的时间复杂度就恒定的。只有当现有的空间不够用时,才发生内存的重新申请和释放操作。最简单的增长方法就是增长一倍,即乘以2,这样内存分配的大小就是2的幂次方。
-When the number of elements in the array change, do not re-apply for the memory space, the array can continue to use. This will improve efficiency.
Algorithm for the machine, the "time" and "space" of the conflict is always there: a little more storage, running on the faster store less, running on more slowly. Embodied in here, this treatment is a space for time. Although the memory space is "wasted" some of the space, but in a very long time, as long as the space has not changed, run on a constant time complexity. Only when existing space is not enough, the only place to re-apply and release the memory operation. The easiest way is to double the growth, that is multiplied by 2, so the size of memory allocation is a power of 2.
对于机器算法中,“时间”和“空间”的矛盾总是存在的:存储多一点,运行就快些;存储少了,运行就慢些。在这里就体现了,这样处理是用空间换时间。虽然在内存空间上是“浪费”了部分的空间,但是在很长一段时间里,只要空间没有发生变化,运行的时间复杂度就恒定的。只有当现有的空间不够用时,才发生内存的重新申请和释放操作。最简单的增长方法就是增长一倍,即乘以2,这样内存分配的大小就是2的幂次方。
-When the number of elements in the array change, do not re-apply for the memory space, the array can continue to use. This will improve efficiency.
Algorithm for the machine, the "time" and "space" of the conflict is always there: a little more storage, running on the faster store less, running on more slowly. Embodied in here, this treatment is a space for time. Although the memory space is "wasted" some of the space, but in a very long time, as long as the space has not changed, run on a constant time complexity. Only when existing space is not enough, the only place to re-apply and release the memory operation. The easiest way is to double the growth, that is multiplied by 2, so the size of memory allocation is a power of 2.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
DArray-better\DynamicArray.dsw
.............\DynamicArray.ncb
.............\DynamicArray.plg
.............\DynamicArray.dsp
.............\DArray.h
.............\.ebug\vc60.idb
.............\.....\vc60.pdb
.............\.....\DynamicArray.exe
.............\.....\DynamicArray.pdb
.............\.....\DynamicArray.ilk
.............\.....\DynamicArray.pch
.............\.....\main.obj
.............\.....\DArray.obj
.............\main.cpp
.............\DArray.cpp
.............\DynamicArray.opt
.............\Debug
DArray-better
.............\DynamicArray.ncb
.............\DynamicArray.plg
.............\DynamicArray.dsp
.............\DArray.h
.............\.ebug\vc60.idb
.............\.....\vc60.pdb
.............\.....\DynamicArray.exe
.............\.....\DynamicArray.pdb
.............\.....\DynamicArray.ilk
.............\.....\DynamicArray.pch
.............\.....\main.obj
.............\.....\DArray.obj
.............\main.cpp
.............\DArray.cpp
.............\DynamicArray.opt
.............\Debug
DArray-better