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)

Answers were Sorted based on User's Feedback



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

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

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

Answer / om

just use recursion .....it's simple......

Is This Answer Correct ?    4 Yes 3 No

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

Answer / santhoshr

It wont work exactly if the no of nodes is not given!!! So
better answer is having two pointers from first itslf.
And like this , another question is there,
to find the pth node from last!! That too haas the same logic!!!

Is This Answer Correct ?    2 Yes 1 No

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

Answer / kar..

move the front pointer and rear pointer at equal
intervel,these both pointe will meet at one node is middle...

Is This Answer Correct ?    2 Yes 3 No

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

Answer / dhr

it also works

Is This Answer Correct ?    1 Yes 3 No

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

Answer / vadivel

U mean without any looping statements r just for loop?????
It can be done in a single traversal using Hare n turtle
method as said above using a for or while loop.....
Without using looping statements d list can't be traversed..
Plz make the question clear.....

Is This Answer Correct ?    3 Yes 10 No

Post New Answer

More C Interview Questions

What is scope rule in c?

0 Answers  


Why doesnt long int work?

0 Answers  


Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?

3 Answers   HCL, TCS,


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

0 Answers  


can any one tel me wt is the question pattern for NIC exam

0 Answers   NIC,


Is main an identifier in c?

0 Answers  


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

0 Answers   TCS,


write a program to insert an element at the specified position in the given array in c language

5 Answers   Appin, IBM,


How do i store a paragraph into a string? for example, if i input a long paragraph, the program will read the words one by one and concatenate them until no word is left.

1 Answers  


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

0 Answers  


How do I get a null pointer in my programs?

0 Answers  


Differentiate between a structure and a union.

0 Answers   Zensar,


Categories