Reference Section: Methods from the LinkedNode class used to…
Reference Section: Methods from the LinkedNode class used to build a singly linked list: LinkedNode(T item, LinkedNode next) Constructs node combining item data with a reference to another node. T getData() Accesses the data reference within this node. void setData(T item) Mutates (changes) this node’s data to be item. LinkedNode getNext() Accesses the next reference within this node. void setNext(LinkedNode n) Mutates (changes) this node’s next reference to be n. Question: Which of the following correctly prints out the data associated with the THIRD element (aka the element of index 2) in a singly linked list of LinkedNode objects, where head refers to the first element of the list? Note: As usual in CS300, this implementation does not use a “dummy node”.
Read Details