Beispiel #1
0
        private void Giris_Load(object sender, EventArgs e)
        {
            using (var db = new OtelDbcontext())
            {
                var             query = from a in db.OtelKayits.OrderBy(p => p.OtelAd) select a;
                OtelKayit       o     = new OtelKayit();
                IkiliAramaAgaci ikili = new IkiliAramaAgaci();
                foreach (var item in query)
                {
                    o = item;
                    ikili.Ekle(o);
                }
            }
            Heap heap = new Heap(100);

            using (var db = new OtelDbcontext())
            {
                int       size  = 0;
                int       count = (from a in db.OtelKayits select a).Count();
                var       query = from a in db.OtelKayits select a;
                HashMap   h     = new HashMap(count);
                OtelKayit o     = new OtelKayit();
                foreach (var item in query)
                {
                    if (size == count)
                    {
                        break;
                    }
                    o = item;
                    h.AddOtel(size, o);
                    heap.Insert(o);
                    MessageBox.Show(h.GetOtel(size).ToString());
                    size++;
                }
                HeapSort heapSort = new HeapSort(heap.ReturnHeap());
                //heapler icinde en yuksek otel puanına gore asağıdaki sorted ın içine çeker dizi şeklinde
                HeapDugumu[] sorted = heapSort.Sort();
            }
        }