Is it standard for a linked list node to have both previous and next pointers?
Code:struct node { int data; struct node *prev; struct node *next; };
spoon_
Is it standard for a linked list node to have both previous and next pointers?
Code:struct node { int data; struct node *prev; struct node *next; };
spoon_
{RTFM, KISS}
Having two pointers makes it easier to traverse and edit the list.
For most applications, a next pointer will suffice. Only when you need more complex navigation both are needed. Note that you don't have to have just those two. And you can also have multidimensional lists, just as in an array...
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
isn't a linked list with pointers next and previous a double-linked list?
Ahh, okay. A double linked list.
thanks,
spoon
{RTFM, KISS}