Esempio n. 1
0
        public void Sort(List <T> collection)
        {
            var heap = new BinaryHeap <T>(collection);

            List <T> elements = new List <T>(heap.Count);

            int position = heap.Count - 1;

            while (heap.Count > 0)
            {
                var maxElement = heap.ExtractMax();
                collection[position] = maxElement;
                position--;
            }
        }