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

What is the time and space complexities of merge sort and when is it preferred over quick sort?

1007


Are pointers really faster than arrays?

962


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1908


What is non linear data structure in c?

962


Tell me about low level programming languages.

1063


Write a factorial program using C.

1014


What are the 5 types of inheritance in c ++?

957


What is static function in c?

1063


Why c is called top down?

1086


write a program to copy the string using switch case?

2840


What are the differences between new and malloc in C?

1067


What is the code for 3 questions and answer check in VisualBasic.Net?

2098


in linking some of os executables are linking name some of them

2074


Explain what are global variables and explain how do you declare them?

1081


What’s the special use of UNIONS?

1103