educative.io

Educative

Shouldn't we also set to NULL the pointer of first element after deletion?

Hi,
I think one more thing needs to be done and that is setting the nextElement pointer of firstElement to null after deletion. otherwise it is still pointing although Head is not looking at it but it is still pointing. So GC won’t pick it up for cleanup.

You are absolutely right we have updated the explanation of this lesson.

Let me know if you have any other queries. Happy learning!

Maida Ijaz | Developer Advocate
educative.io