All Questions
Tagged with array data-structures
18 questions
0
votes
1
answer
186
views
Elegant way in C to store many parameters with default value and current value in embedded flash
I'm programming an embedded system that has a number of user configurable parameters, which are stored in flash memory. I have to store a default value for each parameter as well as the user settings. ...
4
votes
2
answers
1k
views
Arrays vs Maps for listing items that have a unique id
I've been finding that for a lot of code I've been writing recently, it naively might look like this:
Array approach:
const options = [
{
id: 'red',
label: 'Red',
data: '#f00'
...
0
votes
1
answer
124
views
how to store the data for function f(time,length)
I have a function which has discrete time step ,discrete length from origin . These two give height of the function. For example at time 1.2sec , and length 5.5cm from origin height is 10cm. The step ...
1
vote
3
answers
516
views
Are 'array elements' and 'array values' the same?
Array := {"title": "Book Title", "author": "John Doe"}
Some people use the following terminology:
title and author are keys.
Book Title and John Doe are values.
"title": "Book Title" and "author": "...
3
votes
4
answers
119
views
Store csv data as rows or columns in view of the needed processing?
Assume I have some data a csv-Files like
ObjectName, PropertyA, PropertyB, PropertyC
"Name1", 3, 1, 4
"Name2", 1, 5, 9
"Name3", 2, 6, 5
...
and a typical question I want to answer would be
For ...
3
votes
3
answers
668
views
Why are arrays often treated as second-class citizens?
In many programming languages, arrays don't get as much attention as other data structures. In Java, there is no Array<T> type collection to make arrays feel more consistent, such as in ...
44
votes
2
answers
52k
views
PHP: when to use arrays, and when to use objects for mostly-data-storing code constructs?
PHP is a mixed paradigm language, allowing to use and return non-object data types, such as arrays. I pose a question to try to clarify some guidelines for selection of arrays vs objects when deciding ...
2
votes
2
answers
795
views
Non-fixed-size Fenwick Tree implementation
I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements.
All implementations and samples I've seen so far ...
3
votes
2
answers
5k
views
2D linked list vs. multidimensional array/vector
I hope that programmers is the correct stack exchange for this, as it is quite a concept based question.
I'm working on a data structure in C++ that is a represents data in 3D space. The x-y plane is ...
7
votes
3
answers
21k
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. ...
4
votes
2
answers
3k
views
Data structure for grid with negative indeces
Sorry if this is an insultingly obvious concept, but it's something I haven't done before and I've been unable to find any material discussing the best way to approach it.
I'm wondering what's the ...
1
vote
1
answer
3k
views
Is a PHP array an example of a dynamic data structure?
I did my homework, and it says that dynamic data structures are "data structures that change in size as a program needs it to by allocating and de-allocating memory from the heap".
So I was wondering,...
1
vote
3
answers
2k
views
Choice between 1-dimensional and 2-dimensional array
I'm implementing the Chessboard class to represent the chessboard. I've to implement the transformations (reflections and rotations) on the chess board possible.
The possible transformations includes ...
0
votes
2
answers
1k
views
PHP SplFixedArray How To Deal With billions of indexes?
I've built a flatfile db system that will work like mini-noSQL system
and it split db to smaller files, and I did a SplFixedArray wrapper for it
with a method for searching usage built on preg_grep.
...
1
vote
1
answer
1k
views
ruby-idiomatic hashes vs arrays
So I am still fairly new to ruby, though I have noticed that it is very hard to create 2d-array and that hashes seem to be more of the go to data structure than arrays.
I was wondering why the Ruby ...