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...

pgm to find middle element of linklist(in efficent manner)

Answer Posted / sharan

NODE display_middle(NODE first)
{
int count = 0;
NODE temp,mid;

for ( temp = mid = first, count=0; temp ; temp = temp ->
link,count++)

{
if ( count % 2 )
{
mid = mid -> link;
}
}
return mid;
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between class and object in c?

1241


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

2120


What is union and structure?

1195


Why is event driven programming or procedural programming, better within specific scenario?

2485


What is a volatile keyword in c?

1212


FILE PROGRAMMING

2296


Why do we use stdio h and conio h?

1136


What is realloc in c?

1166


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

1142


What is the difference between the expression “++a” and “a++”?

1275


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

2096


Why shouldn’t I start variable names with underscores?

1119


How many types of operators are there in c?

1088


Why is c called c not d or e?

1146


What is %lu in c?

1332