educative.io

Question about method .printList() on lesson "Single Linked List Insertion"

Hi everyone,

Regard the lesson found on Introduction to Linked List > Single Linked List Insertion, I found that we insertAtHead values from 0 to 9. So first node becomes 9, 8, 7, …, and 0.

So with the logic of .printList() in this lesson, 0 is not showing. In other words, the last node of the list will never be printed. It’s like the last node is not counted as part of the list.

My question is if this is a bug or the way we think about linked list? That is when this list has only one element, nothing should be printed?

Hi Duy,

That was a bug on our side. We have fixed this issue. Thank you so much for pointing it out.

If you have any other queries let us know.

Maida Ijaz | Developer Advocate
educative.io