All Questions
19 questions
0
votes
3
answers
127
views
How multiple type lists are stored in memory?
Arrays are stored in a linear fashion, with memory cells of fixed size for each element. To have fixed sized memory cells Arrays should be homogenious. So in Arrays we get an Nth element by skipping ...
8
votes
2
answers
6k
views
Is there a sensible way to sort coordinates?
Sorting is generally used to solve problems where distance between elements matters. A sorted list/array has the convenient property that the smaller the difference between the indices of any two ...
-2
votes
1
answer
2k
views
C# is fantastic, if only List 'd respect Remove&Return [closed]
In the domain of system-modeling (e, systemVerilog, matlab, phyton), lists are obsoleting arrays, stacks and queues(*) altogether. Other domains that use python, perl and ruby have that same mindset, ...
1
vote
2
answers
610
views
Are there any use cases for List when Deques and Arrays are available?
I've been thinking about this over the past few weeks, and I've come up with no good arguments. My perspective is from Java, but if anyone has any language-specific cases outside of this language, I'...
1
vote
0
answers
73
views
How should I store a frequently accessed array with an unknown number of elements in mongodb?
I have a simple "Index" object defined as follows:
{
"position": 4,
"value": 345
}
And I'm trying to figure out the best way to store this object in a mongo database, assuming that:
The "position"...
-4
votes
2
answers
4k
views
How to create a method that takes array list as argument?
To create a method that takes an array as an argument, you would do this:
public static void printAges(int[] age) { // prints ages to screen
for (int x = 0; x < age.length; x++) {
...
1
vote
4
answers
1k
views
Chunking an array into letter groups that are generally equal length
Given a list of items, I want to break it up into four groups with as equal length as possible. The items need to stay grouped by the first letter in each item as well.
26 letters / 4 groups would ...
1
vote
4
answers
89
views
Obtaining lists from an array
Let's say my array contains integers. I'd like to create lists, so that every list contains indexes where a particular value occured in the array. For instance, if the array was 5,0,3,5,2,5,3, we ...
0
votes
1
answer
594
views
How to save tuplas values, to later search on it
Scenario
I have some values of the type : (Name - Email)
From this couples of data, I have to set a ArrayList of "Name" values,something like: |Name1|Name2| --- |NameN| to set a Spinner. (Ordered ...
55
votes
5
answers
206k
views
What's the use of .Any() in a C# List<>?
I've been discussing this with colleagues, and we couldn't figure out what the use is of .Any for any given List<>, in C#.
You can check the validity of an element in the array like the ...
3
votes
1
answer
2k
views
Why is iterating through List<T> more expensive than iterating through Array in .NET?
According to the answers in this post, List<T> is backed by an Array. According to this article, list iteration is considerably slower than array iteration.
If Lists are arrays 'under the hood',...
3
votes
1
answer
251
views
Why use atomic vectors or matrices in R at all?
In reading Hadley Wickham's Advanced R I learned about the difference between atomic vectors and lists; and matrices/arrays and dataframes. This is something I hadn't really appreciated before, and ...
2
votes
2
answers
3k
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:
...
0
votes
1
answer
251
views
Why is first column of list called 0th in so many languages? [duplicate]
If you want first element of list or array you reference it as 0 in many languages (like C or Clojure). Is there are some really good reasons why the programming languages was design this way?
In ...
-1
votes
1
answer
797
views
Design Pattern : Static Array/List in Class Object
I'm a CS alumni, but we didn't learn much by the way of OOP, or Design Patterns. I've heard the phrase C with iostreams and thought it fitting. Anyway that's besides the point. I am just curious about ...