public ThreadedNode(Node node) { this.key = node.Key; this.level = node.Level; this.left = this.right = null; this.is_threaded_left = this.is_threaded_right = false; }
public ThreadedNode(int level) { this.level = level; this.key = double.PositiveInfinity; this.left = this.right = null; this.is_threaded_left = this.is_threaded_right = false; }
public ThreadedNode(double key, int level) { this.key = key; this.level = level; this.left = this.right = null; this.is_threaded_left = this.is_threaded_right = false; }
public ThreadedNode(bool is_threaded_left, bool is_threaded_right) { this.is_threaded_left = is_threaded_left; this.is_threaded_right = is_threaded_right; this.key = double.PositiveInfinity; this.left = this.right = null; this.level = -1; }
private void right_re_build(ThreadedNode th_node) { if (th_node.right != null) { if (!th_node.right.IsThreadedRight) right_re_build(th_node.right); } else { th_node.IsThreadedRight = true; th_node.right = p_old; } p_old = th_node; if (!th_node.IsThreadedLeft) right_re_build(th_node.left); }
private void re_build() { ThreadedNode new_root = new ThreadedNode(true, true); new_root.left = Root; new_root.right = new_root; root = new_root; p_old = Root; left_re_build(Root.left); p_old = Root; right_re_build(Root.left); p_old = null; }
private void build(ref ThreadedNode th_node, Node node) { if (node != null) { th_node = new ThreadedNode(node); build(ref th_node.left, node.left); build(ref th_node.right, node.right); } else th_node = null; }
public ThreadedBinTree(BinTree bin_tree) { if (bin_tree == null || bin_tree.Root == null) root = null; else { root = new ThreadedNode(bin_tree.Root); max = bin_tree.max; build(ref Root.left, bin_tree.Root.left); build(ref Root.right, bin_tree.Root.right); re_build(); } }