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 |
Is null valid for pointers to functions?
how the compiler treats any volatile variable?Explain with example.
Write a program to reverse a given number in c?
Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?
what is the meaning of java that is (J A V A) full form of JAVA
71 Answers AKS University, Bhel, BNL, BPO, HCL, Peacecon,
What is the difference between volatile and const volatile?
Explain what is the difference between functions abs() and fabs()?
what is the maximum limit of row and column of a matrix in c programming. in linux .
What is a pragma?
What is New modifiers?
What is the advantage of a random access file?
How to removing white spces in c programming only bu using loops