Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write an algorithm and a program to count the number of
elements in a circularly singly linked list



write an algorithm and a program to count the number of elements in a circularly singly linked lis..

Answer / 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

More C Interview Questions

What is array of structure in c?

0 Answers  


How would you find a cycle in a linked list?

3 Answers   NSN,


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

0 Answers   Google,


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

0 Answers  


what is diffrence between string and character array?

1 Answers  


What does %2f mean in c?

0 Answers  


how to print value of e(exp1)up to required no of digits after decimal?

1 Answers  


write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer

1 Answers  


sir, i cannot find the way how to write aprogram by using array on queue

1 Answers   IISIT,


What is the difference between procedural and functional programming?

0 Answers  


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

0 Answers  


Is array a primitive data type in c?

0 Answers  


Categories