我几乎可以肯定这应该是一个重复,但我搜索了一段时间,无法找到答案。我应该使用在C#中替换C ++向量和deque 有效。这是我需要一个结构,有效地支持直接索引,并支持从一个或两个端点(取决于向量或deque case)再次以一种有效的方式删除。
I am almost certain this should be a duplicate but I searched for some time and could not find the answer. What should I use in C# to replace C++ vector and deque efficiently. That is I need a structure that supports direct indexing effieciently and also supports delete from one or both ends(depending on vector or deque case) again in an efficient manner.
java我通常使用ArrayList至少为向量,但对于C#我发现这个源说: ArrayList动态调整大小。随着元素的添加,它增加容量以容纳它们。它最常用于较旧的C#程序。。那么什么是新的方法呢?
In java I usually use ArrayList at least for vector but for C# I found this source that states: ArrayList resizes dynamically. As elements are added, it grows in capacity to accommodate them. It is most often used in older C# programs.. So what is the new way to do this? And again what do I do for the deque case?
推荐答案没有内置的Deque容器,但有几个实现可用
There's no built-in Deque container, but there are several implementations available.
这里是一个来自Stephen Cleary的好人。
与Vector相同的C#是 列表< T> 。索引访问是O(1),但是插入或删除是O(N)(除了在末尾插入,这是O(1))。
The C# equivalent to Vector is List<T>. Indexed access is O(1), but insertion or removal is O(N) (other than Inserting at the end, which is O(1)).
更多推荐
c ++等价于c ++向量或deque
发布评论