Comments on: Singly linked list implementation of Queue https://demo.ritambhara.in/singly-linked-list-implementation-of-queue/ Coding / System Design Interviews Tue, 10 Sep 2013 02:55:49 +0000 hourly 1 https://wordpress.org/?v=6.7.2 By: Kamal Rawat https://demo.ritambhara.in/singly-linked-list-implementation-of-queue/#comment-1946 Tue, 10 Sep 2013 02:55:49 +0000 http://www.ritambhara.in/?p=2666#comment-1946 In reply to Shakul.

This is C++ code and Node struct has Constructor which initialize its link field to NULL. Hence in your point-1, node->next (node->link) will actually be set to NULL..

]]>
By: Shakul https://demo.ritambhara.in/singly-linked-list-implementation-of-queue/#comment-1945 Mon, 09 Sep 2013 16:17:59 +0000 http://www.ritambhara.in/?p=2666#comment-1945 1. If you are assuming “new” operator will give you node where node->next is set to NULL, then this program is fine. But in reality new operator doesn’t give this guarantee.
2. If this is not your assumption then deleting single node will misbehave the program i.e. after deleting the single node also front will be non NULL (having some uninitialized value) and queue empty condition will go for toss.

]]>