Data Structure Linked list Question:
Download Questions PDF

Explain how to find 3rd element from end in a linked list in one pass?

Linked list Interview Question
Linked list Interview Question

Answer:

This is another frequently asked linked list interview question. This question is exactly similar to finding middle element of linked list in single pass. If we apply same trick of maintaining two pointers and increment other pointer, when first has moved upto 3rd element, than when first pointer reaches to the end of linked list, second pointer will be pointing to the 3rd element from last in a linked list.

Download Linked list Interview Questions And Answers PDF

Previous QuestionNext Question
Do you know how to find if linked list has loop?Suppose In an integer array, there is 1 to 100 number, out of one is duplicate, how to find?