Article Directory
illustrate
The two classes given here are linked list auxiliary classes when brushing force buttons:
- ListNode linked list node class
- ListNodeMgr linked list management class (output linked list elements)
the code
ListNode
public class ListNode
{
public int val;
public ListNode next;
public ListNode(int val = 0, ListNode next = null)
{
this.val = val;
this.next = next;
}
}
ListNodeMgr
public class ListNodeMgr
{
public static void PrintListNode(ListNode head)
{
ListNode tempNode = head;
while(tempNode != null)
{
Debug.Log(tempNode.val);
tempNode = tempNode.next;
}
}
}