Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Any point in using linked lists?

Name: Anonymous 2016-01-05 0:44

Except than being too lazy to use arrays? The amount of cache misses you are going to get overweights the other benefits.

Name: Cudder !cXCudderUE 2016-01-05 4:30

Infrequent appending/removing, and/or random insertion with large objects (that didn't come out right...)

>>4
Yes.
struct Node {
int val;
int left;
int right;
} nodes[10];

Name: Anonymous 2016-01-05 4:34

>>5
Infrequent appending/removing
You mean frequent and in the middle or start.
Or else there is no use in linked lists.

And use size_t next time.

Name: Anonymous 2016-01-05 4:37

>>5
Yes.
here is a better one more fitting into the array spirit
struct Node
{
int val;
bool hasLeft, hasRight;
};

Name: Anonymous 2016-01-05 6:11

>>5
Now implement a self-balancing binary tree.

Name: Anonymous 2016-01-05 10:29

>>1
Cache misses are only a problem in garbage like C, where individual nodes stay their arbitrarily allocated location and don't dynamically congregate alongside their linked neighbors across GC passes.

The advantages of linked lists outweigh the extra cache pressure. If the list is small, it's negligible. If the list is large, it'll be optimized [if it doesn't already retain certain tail-sharing advantages of its listness].

Name: Anonymous 2016-01-05 12:47

>>8
Are you stupid? Of course you are.

>>5-chan's approach basically consists of using an array-backed allocator. Implementing a self-balancing binary tree would look exactly like it is with using genuine linked lists, only using her custom malloc/free-lookalikes that initialize and return a reference to a new array element or add it to the free list (that >>5-chan forgot to mention).

>>8, how do you find the index of the right subnode without iterating over the entire left subtree first?

Name: Anonymous 2016-01-05 19:50

>>10
her
lmao

Name: Anonymous 2016-01-05 20:02

>>9

Which advantages are those?

Name: Anonymous 2016-01-05 21:15

>>10
Are you intelligent? Of course you are.

Name: Anonymous 2016-01-05 21:33

>>9
Nice theoretical bullshitte

Name: Anonymous 2016-01-05 21:38

>>9
Google "advanced memory management|allocation for game engines". Don't blame C for your laziness and stupidity.

Name: Anonymous 2016-01-05 21:43

>>15
C
laziness
U MENA HASKAL

Name: Anonymous 2016-01-07 5:41

>>9-san is Haskal!!!1

Name: Anonymous 2016-01-07 19:39

>>9
congregate alongside their linked neighbors across GC passes.

Huh. That's an interesting point.

Name: Anonymous 2016-01-07 20:59

>>9 >>18
And the most copying GC does this fairly well. It's one of the most underrated and elegant algorithms, I think.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List