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

When is a “switch” statement preferable over an “if” statement?

1208


What do you mean by scope of a variable in c?

1055


Is array a primitive data type in c?

1131


What is the scope of static variable in c?

1078


What is pointer in c?

1246


What is a buffer in c?

1053


How can you tell whether a program was compiled using c versus c++?

1160


What functions are in conio h?

1262


What is the role of && operator in a program code?

1131


What is structure in c language?

1237


Which is the best website to learn c programming?

1133


How is actual parameter different from the formal parameter?

1059


Why string is used in c?

1047


Explain the difference between the local variable and global variable in c?

1133


how should functions be apportioned among source files?

1162