programacion

Páginas: 3 (714 palabras) Publicado: 18 de agosto de 2014
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// PROGRAMA ARBOLES BINARIOS

namespace arboles_binarios
{
class Program
{class arbol
{
double info;
arbol izq, der;
public arbol()
{
info=0;
izq=null; //trabaja como apuntadorder = null; //trabaja como apuntador
}

public arbol raiz = null;

//metodod insertar

public void insertar()
{int bandera = 0;
arbol tem;
Console.Write("ingrese un numero:");
double dato = double.Parse(Console.ReadLine());
arbolhoja = new arbol();
hoja.info = dato;
if (raiz == null)
{
raiz = hoja;

}
else{
tem = raiz;
while (bandera != 1)
{
if (hoja.info < tem.info)
{if (tem.izq == null)
{
tem.izq = hoja;
bandera = 1;
}else
{
tem = tem.izq;
}
}
else{
if (tem.der == null)
{
tem.der = hoja;
bandera = 1;}
else
{
tem = tem.der;
}
}...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Programación
  • Programacion
  • Programacion
  • Programación
  • Programacion
  • Programacion
  • Programacion
  • Programacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS