A linked list is a common data structure made of a chain of nodes in which each node contains a value and a pointer to the next node in the chain. … When the list is empty, the head pointer points to null.
Which statement is used to check the linked list is empty?
Generally, you’d leave list = NULL until some data is inserted. At which point, you’d allocate a node, assign list to the memory, set the data member and make the next member NULL. Similarly when deleteing the list, you’d set list to NULL after removing the last piece of data.
What does empty linked list consists?
With this convention, an empty list consists of the sentinel node alone, pointing to itself via the next-node link. The list handle should then be a pointer to the last data node, before the sentinel, if the list is not empty; or to the sentinel itself, if the list is empty.