I'm currently learning Cambridge Book of dataStructures and each time I think about a problem, before I see the solution, I'm trying to solve it.
I'm Having a problem with RemoveLast()
public void RemoveLast()
{
if (end != null)
{
Node runner = start; //if end != null then start is initialized.
while (runner != end)
{
runner = runner.Next;
}
runner.Next = null;
end = runner;
}
}
What is the problem in my code? Thx guys!