Explain how to find 3rd element from end in a linked list in one pass?
Answer / Mithilesh Prasad
One approach is to maintain two pointers slow and fast initially at the head of the list. Move fast two steps ahead for each step that slow moves forward. Once fast reaches the end, slow will point to the second to last node. Move slow one more step forward to get the third-to-last node.
| Is This Answer Correct ? | 0 Yes | 0 No |
How do I sort hashset?
What's the difference between a hashtable and a hashmap?
Evaluate the following prefix expression " ++ 26 + - 1324"
24 Answers College School Exams Tests, Patni,
What type of algorithm is binary search?
Explain singly linked list in short.
What is the limit of arraylist?
There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree?
What is definition list?
Can map contain duplicate keys?
Is heap sort adaptive?
What is array indexing?
State the rules to be followed during infix to postfix conversions?