Exemplo n.º 1
0
        static void Main(string[] args)
        {
            MaxHeapImpl heap = new MaxHeapImpl(6);

            heap.Insert(5);
            heap.Insert(6);
            heap.Insert(7);
            heap.Insert(8);
            heap.Insert(10);
            heap.Insert(11);
            Console.WriteLine(heap.GetMax());
            Console.WriteLine(heap.Delete());
            Console.WriteLine("Hello World!");
        }
Exemplo n.º 2
0
        public async Task <IMaxHeap <T> > GetCurrentSnapshot()
        {
            await this.InitializeStoreAsync().ConfigureAwait(false);

            var maxHeap      = new MaxHeapImpl <T>();
            var inMemorySnap = await this.underlyingPersistedStore.GetAllValuesAsync(this.cancellationToken).ConfigureAwait(false);

            foreach (var entry in inMemorySnap)
            {
                var metadata = HandyUtil.DeSerialize <T>(entry.Value);

                maxHeap.Insert(metadata);
            }

            return(maxHeap);
        }