public override void BeginAlgorithm(int[] elements) { ReDrawClass.maxWidth = maxWidth; ReDrawClass.maxHeight = maxHeight; ReDrawClass.threadDelay = threadDelay; ReDrawClass.graphics = graphics; CreateTree(elements); ReDrawClass.ScanThroughAllElements(elements); root.PreOrderTraversal(elements); Thread.Sleep(220); }
public void PreOrderTraversal(int[] elements) { if (leftNode != null) { leftNode.PreOrderTraversal(elements); } for (int i = 0; i < count; i++) { elements[TreeSort.index] = value; TreeSort.index++; ReDrawClass.ReDrawDisplay(elements, TreeSort.index); } if (rightNode != null) { rightNode.PreOrderTraversal(elements); } }