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
What are the two types of structure?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What is the ANSI C Standard?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
Why we use void main in c?
Explain logical errors? Compare with syntax errors.
What is #define?
What are called c variables?
What is static and volatile in c?
The statement, int(*x[]) () what does in indicate?
Explain pointers in c programming?
How can I avoid the abort, retry, fail messages?
Explain what is the difference between the expression '++a' and 'a++'?
Write the Program to reverse a string using pointers.
Explain how do you print an address?