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

foreache

Name: Anonymous 2014-01-20 18:58

what is you're opinion on foreache loops?

i don't like em cuz they ache in the fore

Name: Anonymous 2014-01-24 1:53

>>77
By having the struct look like this, for example.

struct linked_list {
struct linked_list *list_this_is_a_subset_of;

struct linked_list **lists_that_are_sublists_of_this_list;

size_t length;
struct linked_list_node *head;
}


Then append makes sure the thing to be appended to has a NULL next and that the list to be appended isn't a sublist of anything else, concatenates the two together, walks up to the parent of all lists, then walks down all sublists, fixing the lengths as appropriate. nth_tail likewise adds an entry to lists_that_are_sublists_of_this_list (for which a few ancillary variables are omitted to keep the struct cleaner, fill them in depending on how memory-aggressive you want to be) so that it doesn't get left un-updated when its sibling has a list appended to it.

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