public void Resize() { int oldSize = this.Nodes.Length; int newSize = oldSize * 2; //speed: what about *4? CtNode[] newArray = new CtNode[newSize]; int preserveLength = Math.Min(oldSize, newSize); if (preserveLength > 0) { Array.Copy(this.Nodes, newArray, preserveLength); } this.Nodes = newArray; }
public void Resize() { int oldSize = this.Nodes.Length; int newSize = oldSize * 2; //speed: what about *4? CtNode[] newArray = new CtNode[newSize]; int preserveLength = Math.Min(oldSize, newSize); if (preserveLength > 0){ Array.Copy(this.Nodes, newArray, preserveLength); } this.Nodes = newArray; }
public int Visits(int index) { CtNode node = this.Nodes[index]; return(node.NumberOf0S + node.NumberOf1S); }