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

Find the middle node in the linked list??
(Note:Do not use for loop, count and count/2)

Answer Posted / kstarmind

Keep two pointers,
1. fast pointer moves two nodes at a time
2. slow pointer moves one node at a time

keep moving both the pointers, once the fast pointer reaches
the end node, your slow pointer would be at middle of the list.

Is This Answer Correct ?    47 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you assign a different address to an array tag?

1126


How can I prevent another program from modifying part of a file that I am modifying?

1017


Can variables be declared anywhere in c?

1047


How do you print an address?

1219


Difference between Shallow copy and Deep copy?

1978


.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

1245


What is a shell structure examples?

1048


State the difference between x3 and x[3].

1069


How do you determine whether to use a stream function or a low-level function?

1099


why return type of main is not necessary in linux

2060


What is a constant and types of constants in c?

1079


What are the different types of control structures?

998


What are void pointers in c?

973


Why is c called a mid-level programming language?

1164


What is identifier in c?

975