nth node from end of a linked list

Write a C program to return the nth node from the end of a linked list.

Comments

  1. take two pointers
    first move pointer1 by a distance=n
    now move both the pointers till pointer1 reaches end
    you would see that pointer 2 points to nth node from last....

    ReplyDelete
  2. @ankit absolutely correct approach...:)

    ReplyDelete

Post a Comment

Popular posts from this blog