Skip to main content

Find the second last node of a linked list

Find out second last node of given singly linked list. We can solve this problem using single traversal of linked list. Before write actual algorithm consider following test cases.

Test Case 1) : When linked list are empty then show valid message.

2) When linked list are contain less than two nodes then display the (Only one node in this linked list).

3) Find the second last node in single traversal.

Suppose we are inserted the following (6, 3, 2, 7, 1, 9 ) node in a sequence.

Find the second last node of a linked list

Here given code implementation process.





Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment