how to delete every 3rd node in a circular linked list? After deleting that node, the node is continued to count from the node and again deleting the 3rd node?
Do u have any ideas?

To move through a linked-list, you will need an iterator. In your case of deleted every third node, simply use a counter which will increment after traversing each node. Delete the current node when your counter reaches the value 3. Then reset your counter to 1 upon iterating to the next node. Keep running this until your desired stopping condition is reached.

thanks for ur reply..

but i cudn't make it to run the program successfully...cud u plz send the code for that portion?

To move through a linked-list, you will need an iterator. In your case of deleted every third node, simply use a counter which will increment after traversing each node. Delete the current node when your counter reaches the value 3. Then reset your counter to 1 upon iterating to the next node. Keep running this until your desired stopping condition is reached.

struct *p;//node pointing to start
struct *q=p;//starting ptr;
for(q->null)
{

for(i=0;i<4;i++)//move by 3
{*q++;
}
for(j=0;j<3;j++)//move by2
{*p++
}
p->next=q->next;
q=null;
q->next=p;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.