Skip to content

Commit

Permalink
check if it is doubly linked list
Browse files Browse the repository at this point in the history
  • Loading branch information
WaderManasi committed Sep 16, 2020
1 parent 1a9b7ea commit dd9ac13
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Linked Lists/IsDoublyll_Circular.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//Given a doubly linked list, the task is to check if it is circular or not.
bool isCircular(Node * head)
{
if(head==NULL) return false;
Node* temp=head;
Node* p=head->prev;
while(temp->next!=head && temp->next!=NULL)
{
temp=temp->next;
}
return temp->next==head && temp==p?true:false;

}

0 comments on commit dd9ac13

Please sign in to comment.