public void colorearB(Graphics grafo, Font fuente, Brush Relleno, Brush RellenoFuente, Pen Lapiz, AVL Raiz, int busqueda) { Brush entorno = Brushes.Red; if (Raiz != null) { Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); if (busqueda < Raiz.valor) { Thread.Sleep(500); Raiz.Colorear(grafo, fuente, entorno, Brushes.Red, Lapiz); colorearB(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoIzquierdo, busqueda); } else { if (busqueda > Raiz.valor) { Thread.Sleep(500); Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); colorearB(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoDerecho, busqueda); } else { Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); Thread.Sleep(500); } } } }
public void color(Graphics grafo, Font fuente, Brush Relleno, Brush RellenoFuente, Pen Lapiz, AVL Raiz, bool post, bool inor, bool preor) { Brush entorno = Brushes.Red; if (inor == true) { if (Raiz != null) { color(grafo, fuente, Brushes.Red, RellenoFuente, Lapiz, Raiz.NodoIzquierdo, post, inor, preor); Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); Thread.Sleep(500); Raiz.Colorear(grafo, fuente, Relleno, RellenoFuente, Lapiz); color(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoDerecho, post, inor, preor); } } else if (preor == true) { if (Raiz != null) { Raiz.Colorear(grafo, fuente, Brushes.Yellow, Brushes.Red, Pens.Black); Thread.Sleep(500); Raiz.Colorear(grafo, fuente, Brushes.White, Brushes.Black, Pens.Black); color(grafo, fuente, Brushes.Red, RellenoFuente, Lapiz, Raiz.NodoIzquierdo, post, inor, preor); color(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoDerecho, post, inor, preor); } } else if (post == true) { if (Raiz != null) { color(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoIzquierdo, post, inor, preor); color(grafo, fuente, Relleno, RellenoFuente, Lapiz, Raiz.NodoDerecho, post, inor, preor); Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); Thread.Sleep(500); Raiz.Colorear(grafo, fuente, entorno, RellenoFuente, Lapiz); } } }