edited by
774 views
0 votes
0 votes

Function to reverse the circular doubly linked list.
Why is this function showing an error?

head is a global variable.

void reverse()
{
    struct node *z;
    struct node *t = head -> forw;
    while(t != head)
    {
        z=t->back;
        t->back=t->forw;
        t->forw=z;
        t = t -> back;
    }
  z=t->back;
  t->back=t->forw;
  t->forw=z;
  head=t->forw;
}

 

edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
Mrityudoot asked Feb 25
144 views
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.