Beispiel #1
0
        public int DugumSayisi(IkiliAramaAgacDugumu dugum)
        {
            int count = 0;

            if (dugum != null)
            {
                count  = 1;
                count += DugumSayisi(dugum.sol);
                count += DugumSayisi(dugum.sag);
            }
            return(count);
        }
Beispiel #2
0
 private void DerinlikBulInt(IkiliAramaAgacDugumu dugum)
 {
     if (dugum == null)
     {
         return;
     }
     else
     {
         Yukseklik++;
         DerinlikBulInt(dugum.sol);              //Düğümün solu oldukça sola git
     }
 }
Beispiel #3
0
        private void ZiyaretAdvanced(IkiliAramaAgacDugumu dugum)
        {
            if (dugum == null)
            {
                return;
            }

            if (dugum.veri.yabanciDil == "Advanced")
            {
                advancedTemp += "Adı-Soyad:" + dugum.veri.ad + Environment.NewLine;
            }

            ZiyaretAdvanced(dugum.sol);
            ZiyaretAdvanced(dugum.sag);
        }
Beispiel #4
0
        private void btnKayitSil_Click(object sender, EventArgs e)
        {
            OgrenciBilgi o = new OgrenciBilgi();

            o.ogrenciNo = Convert.ToInt32(txtSilinecekOgrenciNo.Text);

            aramaDugum = aramaAgaci.OgrenciNumarasinaGoreAra(Convert.ToInt32(txtSilinecekOgrenciNo.Text));
            aramaAgaci.Sil(o.ogrenciNo);
            string anahtar = aramaDugum.veri.MezunBilgiListesi.BolumBul();
            int    x       = hm.hashFonksiyonu(anahtar, 3);

            hm.table[x].h.ElemanSil(aramaDugum.veri);
            MessageBox.Show("Kayıt Başarılı Bir Şekilde Silindi");
            txtSilinecekOgrenciNo.Text = "";
        }
Beispiel #5
0
 private void OgrenciAdinaGoreArama(IkiliAramaAgacDugumu dugum, string adi, string sifresi)
 {
     if (dugum == null)
     {
         return;
     }
     if (dugum.veri.ad == adi && dugum.veri.sifre == sifresi)
     {
         kilit = true;
     }
     else if (!kilit)
     {
         OgrenciAdinaGoreArama(dugum.sol, adi, sifresi);
         OgrenciAdinaGoreArama(dugum.sag, adi, sifresi);
     }
 }
Beispiel #6
0
        private void Ziyaret90(IkiliAramaAgacDugumu dugum)
        {
            if (dugum == null)
            {
                return;
            }
            double notOrtalamasi = dugum.veri.MezunBilgiListesi.OrtalamaBul();

            if (notOrtalamasi != 0)
            {
                tempOrtalama += dugum.veri.ad + Environment.NewLine;
            }

            Ziyaret90(dugum.sol);
            Ziyaret90(dugum.sag);
        }
Beispiel #7
0
 private IkiliAramaAgacDugumu OgrenciNoGuncelle(IkiliAramaAgacDugumu dugum,
                                                OgrenciBilgi ogr)
 {
     if ((int)dugum.veri.ogrenciNo == ogr.ogrenciNo)
     {
         dugum.veri = ogr;
         return(dugum);
     }
     else if ((int)dugum.veri.ogrenciNo > ogr.ogrenciNo)
     {
         return(OgrenciNoGuncelle(dugum.sol, ogr));
     }
     else
     {
         return(OgrenciNoGuncelle(dugum.sag, ogr));
     }
 }
Beispiel #8
0
        private IkiliAramaAgacDugumu Successor(IkiliAramaAgacDugumu silDugum)
        {
            IkiliAramaAgacDugumu successorParent = silDugum;
            IkiliAramaAgacDugumu successor       = silDugum;
            IkiliAramaAgacDugumu current         = silDugum.sag;

            while (current != null)
            {
                successorParent = successor;
                successor       = current;
                current         = current.sol;
            }
            if (successor != silDugum.sag)
            {
                successorParent.sol = successor.sag;
                successor.sag       = silDugum.sag;
            }
            return(successor);
        }
Beispiel #9
0
 private IkiliAramaAgacDugumu OgrenciNoAraInt(IkiliAramaAgacDugumu dugum,
                                              int anahtar)
 {
     if (dugum == null)
     {
         return(null);
     }
     else if ((int)dugum.veri.ogrenciNo == anahtar)
     {
         return(dugum);
     }
     else if ((int)dugum.veri.ogrenciNo > anahtar)
     {
         return(OgrenciNoAraInt(dugum.sol, anahtar));
     }
     else
     {
         return(OgrenciNoAraInt(dugum.sag, anahtar));
     }
 }
Beispiel #10
0
        public void Ekle(OgrenciBilgi deger)
        {
            IkiliAramaAgacDugumu tempParent = new IkiliAramaAgacDugumu();

            IkiliAramaAgacDugumu tempSearch = kok;

            while (tempSearch != null)
            {
                tempParent = tempSearch;

                if (deger.ogrenciNo == tempSearch.veri.ogrenciNo)
                {
                    return;
                }
                else if (deger.ogrenciNo < tempSearch.veri.ogrenciNo)
                {
                    tempSearch = tempSearch.sol;
                }
                else
                {
                    tempSearch = tempSearch.sag;
                }
            }
            IkiliAramaAgacDugumu eklenecek = new IkiliAramaAgacDugumu(deger);

            if (kok == null)
            {
                kok = eklenecek;
            }
            else if (deger.ogrenciNo < tempParent.veri.ogrenciNo)
            {
                tempParent.sol = eklenecek;
            }
            else
            {
                tempParent.sag = eklenecek;
            }
        }
 public IkiliAramaAgacDugumu(OgrenciBilgi ogr)
 {
     this.veri = ogr;
     sol       = null;
     sag       = null;
 }
Beispiel #12
0
        public bool Sil(int deger)
        {
            IkiliAramaAgacDugumu current = kok;
            IkiliAramaAgacDugumu parent  = kok;
            bool issol = true;

            //DÜĞÜMÜ BUL
            while ((int)current.veri.ogrenciNo != deger)
            {
                parent = current;
                if (deger < (int)current.veri.ogrenciNo)
                {
                    issol   = true;
                    current = current.sol;
                }
                else
                {
                    issol   = false;
                    current = current.sag;
                }
                if (current == null)
                {
                    return(false);
                }
            }
            //DURUM 1: YAPRAK DÜĞÜM
            if (current.sol == null && current.sag == null)
            {
                if (current == kok)
                {
                    kok = null;
                }
                else if (issol)
                {
                    parent.sol = null;
                }
                else
                {
                    parent.sag = null;
                }
            }
            //DURUM 2: TEK ÇOCUKLU DÜĞÜM
            else if (current.sag == null)
            {
                if (current == kok)
                {
                    kok = current.sol;
                }
                else if (issol)
                {
                    parent.sol = current.sol;
                }
                else
                {
                    parent.sag = current.sol;
                }
            }
            else if (current.sol == null)
            {
                if (current == kok)
                {
                    kok = current.sag;
                }
                else if (issol)
                {
                    parent.sol = current.sag;
                }
                else
                {
                    parent.sag = current.sag;
                }
            }
            //DURUM 3: İKİ ÇOCUKLU DÜĞÜM
            else
            {
                IkiliAramaAgacDugumu successor = Successor(current);
                if (current == kok)
                {
                    kok = successor;
                }
                else if (issol)
                {
                    parent.sol = successor;
                }
                else
                {
                    parent.sag = successor;
                }
                successor.sol = current.sol;
            }
            return(true);
        }
Beispiel #13
0
 public IkiliAramaAgaci(IkiliAramaAgacDugumu kok)
 {
     this.kok = kok;
 }
Beispiel #14
0
 private void Ziyaret(IkiliAramaAgacDugumu dugum)
 {
     dugumler += "Adı-Soyadı:" + dugum.veri.ad + " " + "Mezun Bilgileri--> " + dugum.veri.MezunBilgiListesi.DisplayElements() + Environment.NewLine + Environment.NewLine;
 }