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
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is line in c preprocessor?
Is c easy to learn?
What is character constants?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What is the advantage of an array over individual variables?
Tell me when is a void pointer used?
Explain indirection?
Why #include is used in c language?
What is the difference between arrays and pointers?
Explain what is a const pointer?
What is difference between main and void main?
How can I delete a file?
Explain how can I read and write comma-delimited text?