二维数组VS维数组 [英] 2D array vs 1D array

查看:162
本文介绍了二维数组VS维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了这个问题<一href=\"http://stackoverflow.com/questions/1242705/performance-of-2-dimensional-array-vs-1-dimensional-array\">Performance 2维阵列对1维阵列

I have read the question for Performance of 2-dimensional array vs 1-dimensional array

但是,在结束它说可能是相同的(根据地图自己的地图功能,C执行此自动)?...

But in conclusion it says could be the same (depending the map own map function, C does this automatically)?...

我有一个矩阵至极拥有的 1000列和440,000,000行的,每个元素都是一个的的在 C#。 ..

I have a matrix wich has 1,000 columns and 440,000,000 rows where each element is a double in C#...

如果我做在内存中一些计算,其中之一可能是更好的性能方面使用? (请注意,我一定要挺住的信息,这样的monstruos量所需的内存)...

If I am doing some computations in memory, which one could be better to use in performance aspect? (note that I have the memory needed to hold such a monstruos quantity of information)...

推荐答案

如果你要问是哪个更好,尺寸1000x44000或大小44000000的一维数组的二维数组,以及有什么区别,只要内存去?你仍然有相同数量的元素!在性能和可理解的情况下,2D可能是更好的。想象一下,有手动查找每一列或行中的一维数组,当你确切地知道他们是在一个二维数组。

If what you're asking is which is better, a 2D array of size 1000x44000 or a 1D array of size 44000000, well what's the difference as far as memory goes? You still have the same number of elements! In the case of performance and understandability, the 2D is probably better. Imagine having to manually find each column or row in a 1D array, when you know exactly where they are in a 2D array.

这篇关于二维数组VS维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆