Why are we checking if the previousNode != null. Since we never insert a null node into the queue, why don’t we simply say ‘currentNode.next = queue.peek’?
I’d say we actually do not need previousNode at all…
Why not to do for each node
node->next = queue.front()
?
For the very first iteration, previousNode will be ‘null’.