private void Ziyaret(IkiliAramaAgaciDugumu dugum) { otelList.Add(dugum.veri); perlist.Add(dugum.veri.personelBilgi); dugumler += ">> Adı: " + dugum.veri.OtelAdi + " " + "Il-Ilçe: " + dugum.veri.Il_Ilce + " " + "Adres: " + dugum.veri.Adres + " " + "Telefon: " + dugum.veri.Telefon + " " + "EPosta: " + dugum.veri.EPosta + " " + "Yıldız Sayısı: " + dugum.veri.YildizSayisi + " " + "Oda Sayısı: " + dugum.veri.OdaSayisi + " " + "Oda Tipi: " + dugum.veri.OdaTipi + " " + "Puan: " + dugum.veri.OtelPuani + Environment.NewLine + "Otel Yorumları--> " + dugum.veri.OtelYorumList.DisplayElements() + Environment.NewLine + "Personel Bilgileri--> " + dugum.veri.PersonelBilgiList.DisplayElements() + Environment.NewLine + Environment.NewLine; }
private void InOrderInt(IkiliAramaAgaciDugumu dugum) { if (dugum == null) { return; } InOrderInt(dugum.sol); Ziyaret(dugum); InOrderInt(dugum.sag); }
private void DerinlikBulInt(IkiliAramaAgaciDugumu dugum) { if (dugum == null) { return; } else { Yukseklik++; DerinlikBulInt(dugum.sol); //Düğümün solu oldukça sola git } }
public int DugumSayisi(IkiliAramaAgaciDugumu dugum) { int count = 0; if (dugum != null) { count = 1; count += DugumSayisi(dugum.sol); count += DugumSayisi(dugum.sag); } return(count); }
private void btn_OtelSil_Click(object sender, EventArgs e) { foreach (OtelBilgi o in ListOtel) { if (cmbBox_otelSil.SelectedItem.ToString() == o.OtelAdi) { aramaDugum = aramaAgaci.OtelIDAra(o.OtelID); aramaAgaci.OtelSil(aramaDugum.veri.OtelID); string anahtar = aramaDugum.veri.Il_Ilce; int hIndis = hashMap.hashFonksiyonu(anahtar, 10); hashMap.tablo[hIndis].h.ElemanSil(aramaDugum.veri); } } MessageBox.Show("Kayıt Başarılı Bir Şekilde Silindi"); }
private void ZiyaretAdvanced(IkiliAramaAgaciDugumu dugum, OtelBilgi otel) { if (dugum == null) { return; } if (dugum.veri.YildizSayisi == otel.YildizSayisi) { advancedTemp += "Otel Adı:" + dugum.veri.OtelAdi + Environment.NewLine; } ZiyaretAdvanced(dugum.sol, otel); ZiyaretAdvanced(dugum.sag, otel); }
private IkiliAramaAgaciDugumu OtelBilgiGuncelle(IkiliAramaAgaciDugumu dugum, OtelBilgi otel) { if ((int)dugum.veri.OtelID == otel.OtelID) { dugum.veri = otel; return(dugum); } else if ((int)dugum.veri.OtelID > otel.OtelID) { return(OtelBilgiGuncelle(dugum.sol, otel)); } else { return(OtelBilgiGuncelle(dugum.sag, otel)); } }
private IkiliAramaAgaciDugumu OtelPersonelEkle(IkiliAramaAgaciDugumu dugum, OtelBilgi otel) { if ((int)dugum.veri.OtelID == otel.OtelID) { dugum.veri.PersonelBilgiList.InsertLast(otel.personelBilgi); return(dugum); } else if ((int)dugum.veri.OtelID > otel.OtelID) { return(OtelBilgiGuncelle(dugum.sol, otel)); } else { return(OtelBilgiGuncelle(dugum.sag, otel)); } }
private void ziyaretpersonel(IkiliAramaAgaciDugumu dugum, OtelBilgi _o) { if (dugum.veri == null) { return; } string Personel = dugum.veri.PersonelBilgiList.EnYukekPersonel(_o); if (Personel != "") { tempPersonel += dugum.veri.personelBilgi.Ad + "-" + dugum.veri.personelBilgi.Soyad + Environment.NewLine; } ziyaretpersonel(dugum.sol, _o); ziyaretpersonel(dugum.sag, _o); }
private IkiliAramaAgaciDugumu Successor(IkiliAramaAgaciDugumu silDugum) { IkiliAramaAgaciDugumu successorParent = silDugum; IkiliAramaAgaciDugumu successor = silDugum; IkiliAramaAgaciDugumu 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 IkiliAramaAgaciDugumu OtelIDAraInt(IkiliAramaAgaciDugumu dugum, int anahtar) { if (dugum == null) { return(null); } else if ((int)dugum.veri.OtelID == anahtar) { return(dugum); } else if ((int)dugum.veri.OtelID > anahtar) { return(OtelIDAraInt(dugum.sol, anahtar)); } else { return(OtelIDAraInt(dugum.sag, anahtar)); } }
public void OtelEkle(OtelBilgi deger) { IkiliAramaAgaciDugumu tempParent = new IkiliAramaAgaciDugumu(); IkiliAramaAgaciDugumu tempSearch = kok; while (tempSearch != null) { tempParent = tempSearch; if (deger.OtelID == tempSearch.veri.OtelID) { return; } else if (deger.OtelID < tempSearch.veri.OtelID) { tempSearch = tempSearch.sol; } else { tempSearch = tempSearch.sag; } } IkiliAramaAgaciDugumu eklenecek = new IkiliAramaAgaciDugumu(deger); if (kok == null) { kok = eklenecek; } else if (deger.OtelID < tempParent.veri.OtelID) { tempParent.sol = eklenecek; } else { tempParent.sag = eklenecek; } }
public IkiliAramaAgaci(IkiliAramaAgaciDugumu kok) { this.kok = kok; }
public bool OtelSil(int deger) { IkiliAramaAgaciDugumu current = kok; IkiliAramaAgaciDugumu parent = kok; bool issol = true; //DÜĞÜMÜ BUL while ((int)current.veri.OtelID != deger) { parent = current; if (deger < (int)current.veri.OtelID) { 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 { IkiliAramaAgaciDugumu 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 IkiliAramaAgaciDugumu(OtelBilgi otl) { this.veri = otl; sol = null; sag = null; }
private void Ziyaret(IkiliAramaAgaciDugumu dugum) { dugumler += "Adı" + dugum.veri.OtelAdi + " " + "Otel Yorumları--> " + dugum.veri.OtelYorumList.DisplayElements() + Environment.NewLine + Environment.NewLine; }