Delete all odd or even positioned nodes from Circular Linked List | Function to delete that all node whose index position is odd ; check list have any node if not then return ; if list have single node means odd position then delete it ; traverse first to last if list have more than one node ; delete first position node which is odd position ; Function to delete first node ; check position is odd or not if yes then delete node
void DeleteAllOddNode ( struct Node * * head ) { int len = Length ( * head ) ; int count = 0 ; struct Node * previous = * head , * next = * head ; if ( * head == NULL ) { printf ( " Delete Last List is empty " return ; } if ( len == 1 ) { DeleteFirst ( head ) ; return ; } while ( len > 0 ) { if ( count == 0 ) { DeleteFirst ( head ) ; } if ( count % 2 == 0 && count != 0 ) { deleteNode ( * head , previous ) ; } previous = previous -> next ; next = previous -> next ; len -- ; count ++ ; } return ; }