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 |
What is scope rule in c?
Why doesnt long int work?
Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?
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.
can any one tel me wt is the question pattern for NIC exam
Is main an identifier in c?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
write a program to insert an element at the specified position in the given array in c language
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.
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
How do I get a null pointer in my programs?
Differentiate between a structure and a union.