The array tag has no usage guidance.
29
votes
11answers
8k views
How does the “Fourth Dimension” work with arrays?
Abstract:
So, as I understand it (although I have a very limited understanding), there are three dimensions that we (usually) work with physically:
The 1st would be represented by a line.
The 2nd ...
1
vote
2answers
823 views
Why a hashtable? Why not just a non-hashed associative array?
I've been learning about using a hashtable to efficiently check for items in a list without looping through the whole thing, but there's one thing that I don't get:
Why hashed keys?
It seems like:
...
3
votes
6answers
1k views
Why isn't the line count in Visual Studio zero-based?
This just struck me as an oversight by Microsoft. Since arrays and other data-structures within the .NET framework begin from zero (zero-based) why don't we have a line 0 within the code view in ...
8
votes
8answers
17k views
What is the difference between an Array and a Stack?
According to Wikipedia, a stack:
is a last in, first out (LIFO) abstract data type and linear data structure.
While an array:
is a data structure consisting of a collection of elements ...
3
votes
3answers
2k views
Specific reasons to create own array class over using std::array?
What specific conditions or requirements should you create your own array over using std::array?
Here is my background:
I'm developing a small simple library that a small group of people will use ...
4
votes
5answers
4k views
Retrieving maximum value from a range in unsorted array
I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned.
For example:
array[]={23,17,9,45,78,2,4,6,90,1};
query(both inclusive): 2 ...
4
votes
4answers
1k views
Why can't C arrays have 0 length?
The C11 standard says the arrays, both sized and variable length "shall have a value greater than zero." What is the justification for not allowing a length of 0?
Especially for variable length ...
0
votes
3answers
268 views
Why is the complexity of fetching a value from an array be O(1)?
How come the complexity of fetching a value from an array by it's index is O(1)?
I thought the algorithm has to go through all the indexes, find the correct index, and then know what value to return. ...