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 |
What is the limit of arraylist?
Does arraylist guarantee insertion order?
What do you know about the big-o notation and can you give some examples with respect to different data structures?
What is data structure? Explain.
Write an algorithm to show the reverse of link list?
Is hashmap fail safe?
In the given binary tree, using array you can store the node 4 at which location? 1 2 3 - - 4 - - 5
How can we delete the first node from the singly linked list?
Is copyonwritearraylist thread safe?
What is huffman’s algorithm?
What is a stable sorting algorithm?
What is stack algorithm?