Log in
updated 11:29 AM UTC, May 4, 2016

delete mth item from the end of singly linked list

Given a singly linked list of size N , how do u delete an element which is M th from the end?

This is a favorite question of the interviewers , try to explain your solution on a sheet of paper and then write a piece of code for the same.


Keep two variable's , say var1 and var2.

let the var1 run for m times into the list. then start the var2 from the beginning ,now run var1 and var2 simultaneously in a loop till the var1 becomes null (end of list).

Powered by Bullraider.com
Follow Us on Twitter
Find Us on Facebook
Follow Us on Google
Follow Us on Pinterest