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
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 |
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 |
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 |
Read two numbers from keyboard and find maximum of them?
any string of bits of length 'n' represents a unique non- negative integer between.............?
Difference between Function to pointer and pointer to function
write a program to display & create a rational number
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
What is the use of bitwise operator?
What is modifier & how many types of modifiers available in c?
How can I get back to the interactive keyboard if stdin is redirected?
What is the difference between array and pointer in c?
Explain function?
what is memory leak?
How do I use void main?