// Visited dictionary to hold old node reference as "key" and new node reference as the "value" public SLLNode GetClonedNode(Dictionary <SLLNode, SLLNode> originalToClonedDict, SLLNode node) { // If the node exists then if (node == null) { return(null); } // Check if the node is in the visited dictionary if (!originalToClonedDict.ContainsKey(node)) { // Otherwise create a new node, add to the dictionary and return it originalToClonedDict.Add(node, new SLLNode(node.value)); } // If its in the visited dictionary then return the new node // reference from the dictionary return(originalToClonedDict[node]); }
public SLLNode(int value) { Value = value; Next = null; }
public SLLNode(int d) { data = d; next = null; }
public SLLNode(T value) { this.Value = value; this.Next = null; }
public SLList() { this.head = null; this.tail = null; }
public SLLNode(int nodeData) { this.data = nodeData; this.next = null; }