1
$\begingroup$

Let's say you have a standard doubly link list implementation:

struct List {
    int Number;
    struct List *blink;
    struct List *flink;
};

and that you have the following list:

1 <--> 2 <--> 3 <--> 4 <--> 5

Now, in my case, I've been using the flink as a terminator of sorts, and unlinking nodes in a single direction:

1 <--> 2 <--> 3 <--| 4 <--> 5

So 3's flink is null, but 4's blink points to 3.

(Mildly unrelated, I've been doing this to allow for quick modification and restoration of linked lists, and have things like:

1 <--> 2 <--| 3 <--> 4 <--> 5
         <--> 6 <--| 7 <--> 8
                <--> 9 <--> 10 <--> 11

to build a list of 1 2 6 9 10 11. I've been using this for instances where I need data to persist that would normally (as far as my program is concerned) be destroyed when doing a depth-first traversal. Think of it almost as a stack that knows how to restore itself to a previous state.)

My question is really just "does this type of operation/technique have a well defined name?" I've been calling it "shearing", but if there's a real name that'd be nice to know.

$\endgroup$
  • 1
    $\begingroup$ Cross-posted to Stack Overflow. Please do not post the same question to multiple Stack Exchange sites. It is against site policy because it fragments answers and wastes people's time when they work on a question that's already been answered somewhere else. If you agree that a question would have been better asked on a different Stack Exchange site, use the "flag" link below the question to request that it be moved, along with its answers. $\endgroup$ – David Richerby Nov 17 '14 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.