Consider the following definition of a node for a linked list together with a co
ID: 3904401 • Letter: C
Question
Consider the following definition of a node for a linked list together with a constructor. Refer to this in the questions below public class Node char key; Node next; Node (char el) f key- el; next- null; a. (2 marks) Consider the following code snippet (located within the class Node) where head refers to the first nodein a linked list which has already been initialised Node y- new Node('Z'); head- y; Complete the line at 7777 so that the completed code adds the new node containing "z' to the front of the linked list, and updates head so that it points to the added node.Explanation / Answer
If you have any doubts, please give me comment...
Node y = new Node ('Z');
Node head = null; // declaring head variable
head = y;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.