public int DugumSayisi(IkiliAramaAgacDugumu dugum) { int count = 0; if (dugum != null) { count = 1; count += DugumSayisi(dugum.sol); count += DugumSayisi(dugum.sag); } return(count); }
private void DerinlikBulInt(IkiliAramaAgacDugumu dugum) { if (dugum == null) { return; } else { Yukseklik++; DerinlikBulInt(dugum.sol); //Düğümün solu oldukça sola git } }
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); }
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 = ""; }
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); } }
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); }
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)); } }
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); }
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)); } }
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; }
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); }
public IkiliAramaAgaci(IkiliAramaAgacDugumu kok) { this.kok = kok; }
private void Ziyaret(IkiliAramaAgacDugumu dugum) { dugumler += "Adı-Soyadı:" + dugum.veri.ad + " " + "Mezun Bilgileri--> " + dugum.veri.MezunBilgiListesi.DisplayElements() + Environment.NewLine + Environment.NewLine; }