Question: Let the variable list be a reference variable to the head of a linked list of nodes, called LinkedNode; where LinkedNode is defined as
Let the variable list be a reference variable to the head of a linked list of nodes, called LinkedNode; where LinkedNode is defined as follows: class LinkedNode { int data; LinkedNode next; LinkedNode(int i) { } data = i; next = null; A node called temp must be inserted at the front of the list, where temp is defined as: LinkedNode temp = new LinkedNode (200); Define a method called addFirst, that accepts an integer that is used as the data for a new node, and adds this new node to the beginning of the list. You may assume there is an original reference that points to the beginning of the list.
Step by Step Solution
There are 3 Steps involved in it
LinkedNode addfirstLinkedNode ... View full answer
Get step-by-step solutions from verified subject matter experts
