write an algorithm and a program to count the number of
elements in a circularly singly linked list
Answer Posted / rakesh soni
struct node
{
int info;
struct node *next;
};
main()
{
struct node *head,*temp;
// here insert the elements in circular link list & suppose
//head have the starting pointer of circular link list
//head is not null
int count =1;
temp=head;
while(temp->next!= head)
{
count++;
temp=temp->next;
}
printf(" No of Elements = %d",count);
}
| Is This Answer Correct ? | 12 Yes | 14 No |
Post New Answer View All Answers
What is the argument of a function in c?
What are the types of pointers?
Which node is more powerful and can handle local information processing or graphics processing?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
How can I read and write comma-delimited text?
Why main function is special give two reasons?
What is the difference between near, far and huge pointers?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
p*=(++q)++*--p when p=q=1 while(q<=6)
What is function prototype in c with example?
What do you mean by dynamic memory allocation in c? What functions are used?
How do you define a function?
Can you think of a logic behind the game minesweeper.
What is dynamic variable in c?