文件名称:DArray-better
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:286.14kb
-
已下载: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
DArray-better/DynamicArray.ncb
DArray-better/DynamicArray.plg
DArray-better/DynamicArray.dsp
DArray-better/DArray.h
DArray-better/Debug/vc60.idb
DArray-better/Debug/vc60.pdb
DArray-better/Debug/DynamicArray.exe
DArray-better/Debug/DynamicArray.pdb
DArray-better/Debug/DynamicArray.ilk
DArray-better/Debug/DynamicArray.pch
DArray-better/Debug/main.obj
DArray-better/Debug/DArray.obj
DArray-better/main.cpp
DArray-better/DArray.cpp
DArray-better/DynamicArray.opt
DArray-better/Debug
DArray-better
DArray-better/DynamicArray.ncb
DArray-better/DynamicArray.plg
DArray-better/DynamicArray.dsp
DArray-better/DArray.h
DArray-better/Debug/vc60.idb
DArray-better/Debug/vc60.pdb
DArray-better/Debug/DynamicArray.exe
DArray-better/Debug/DynamicArray.pdb
DArray-better/Debug/DynamicArray.ilk
DArray-better/Debug/DynamicArray.pch
DArray-better/Debug/main.obj
DArray-better/Debug/DArray.obj
DArray-better/main.cpp
DArray-better/DArray.cpp
DArray-better/DynamicArray.opt
DArray-better/Debug
DArray-better
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.