示例#1
0
        public void DodajElement(Osoba.Osoba osoba)
        {
            if (korzen == null)
            {
                korzen      = new Wezel();
                korzen.Dane = osoba;
                return;
            }
            Wezel p = korzen, poprzedni;

            do
            {
                poprzedni = p;
                if (osoba.CompareTo(p.Dane) < 0)
                {
                    p = p.Lewy;
                }
                else
                {
                    p = p.Prawy;
                }
            }while(p != null);
            if (osoba.CompareTo(poprzedni.Dane) < 0)
            {
                poprzedni.Lewy      = new Wezel();
                poprzedni.Lewy.Dane = osoba;
            }
            else
            {
                poprzedni.Prawy      = new Wezel();
                poprzedni.Prawy.Dane = osoba;
            }
        }
示例#2
0
 public Wezel(string imie, string nazwisko, int rok, byte miesiac, byte dzien)
 {
     this.Dane  = new Osoba.Osoba(imie, nazwisko, rok, miesiac, dzien);
     this.Lewy  = null;
     this.Prawy = null;
 }
示例#3
0
 public Wezel(Osoba.Osoba osoba)
 {
     this.Dane  = osoba;
     this.Lewy  = null;
     this.Prawy = null;
 }
示例#4
0
 public Wezel()
 {
     this.Dane  = new Osoba.Osoba();
     this.Lewy  = null;
     this.Prawy = null;
 }