Skip to main content

Questions tagged [data-structures]

For questions about the implementation or design of data structures as specifically relevant to programming language design or implementation. Generic data structure questions are off-topic.

-4 votes
3 answers
217 views

Did C++'s std::forward_list really need insert_after, emplace_after, ...
Dannyu NDos's user avatar
  • 1,485
11 votes
7 answers
2k views

Many commonly used programming languages offer built-in mutable container types, or other mutable types that embed references to other objects, and make it trivial to build structures that contain a ...
Karl Knechtel's user avatar
7 votes
0 answers
339 views

A reference or level-0 copy is the same object as the original, only accessed differently. A level-1 shallow copy is a new object, with every member a reference to the member under the same name in ...
user23013's user avatar
  • 3,314
21 votes
6 answers
5k views

The typical syntax for accessing an array (or list, map and similar data structures) at a specific index is a[i]. I believe C first introduced it as syntax sugar, ...
linux_user36's user avatar
6 votes
2 answers
419 views

Sometime during the past year I read (possibly on SO/SE) about a topic that sounded interesting. Now I would like to pick it up but I can't find it again. My memory is somewhat vague, I'm afraid. I ...
Mankka's user avatar
  • 163
2 votes
1 answer
282 views

Contiguous arrays do not mix with lazy evaluation. That's why Haskell doesn't have contiguous arrays as a primitive type, and why even GHC has a poor API for them. As such, I sought for a workaround. ...
Dannyu NDos's user avatar
  • 1,485
12 votes
0 answers
325 views

Consider for a motivating example a copy-on-write array, which implements a persistent (i.e. immutable) array data type. As an optimisation at runtime, a reference counter can be used to avoid the ...
kaya3's user avatar
  • 22.4k
15 votes
3 answers
1k views

In most functional languages I know of, linked lists are the default datastructure of choice for many operations. The benefits are clear - they're clearly encoded with ADTs, and can be utilised easily ...
blueberry's user avatar
  • 2,607
8 votes
7 answers
2k views

Some languages have a concept of classes separately than structs. In C++ the only difference is whether the members are public or private by default. This seems redundant. Why have a separate ...
CPlus's user avatar
  • 10.5k
9 votes
2 answers
1k views

For example, Python has lists, sets and dictionaries as language-level primitives that can be constructed using syntactic sugar [1,2,3], {'a': 1, 'b': 2} while Java ...
kouta-kun's user avatar
  • 1,747
-2 votes
1 answer
250 views

Set theorhetical structures and operations are quite fundamental and typically are either part of a languages standard library or built into it. Given that types are fundamental to programming why do ...
Bruce Adams's user avatar
  • 3,002
8 votes
9 answers
2k views

In C a structure can have an arbitrary amount of padding. In theory this implementation conforms to the C standard: ...
CPlus's user avatar
  • 10.5k
8 votes
7 answers
2k views

I am bothered by the fact that, in C, struct types can be arbitrarily large. We have no control over their memory layout except for the fact that the first member ...
CPlus's user avatar
  • 10.5k
1 vote
2 answers
233 views

For languages that allow generators (iterables where elements are determined by a function), what are the pros and cons of having a unique type for generators? For example, languages like python have ...
lyxal's user avatar
  • 2,045
7 votes
1 answer
129 views

In python, the filter and map functions (among others) are top-level (i.e. global) functions which take an iterable as an ...
Ginger's user avatar
  • 2,707

15 30 50 per page