Question: Given the following structure of a node in a singly linked list, how would you add a new node at the beginning? struct Node {
Given the following structure of a node in a singly linked list, how would you add a new node at the beginning?
struct Node
int data;
struct Node next;
;
Group of answer choices
Create a new node, set its next to the current head, then update the head to the new node.
Create a new node, set its next to NULL, then update the head to the new node.
Create a new node, set its next to the current head, then update the tail to the new node.
Create a new node, set its next to the tail, then update the head to the new node.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
