Exemple #1
0
int main()
{
/*    MaxHeap<int> h = {10,8,7,7,6,3,2,0,1};
    h.Add(11);
    h.print();
    h.RemoveTop();
    h.print(); */

    MaxHeap<int> h = {4,6,2,8,9,2,10};

    std::vector<int> s_vec;
    s_vec = h.Sort();

    for(int v : s_vec)
        std::cout<<v<<" ";
    std::cout<<"\n";

    return 0;
}
int main() {

	int N = 7;
	int a[N];
	for (int i = 0; i < N; ++i)
		a[i] = N-(i);

	KnuthShuffle(a, N);

	cout << "***Before Heap Sort***" << endl;
	for (int i = 0; i < N; ++i)
		cout << a[i] << " ";
	cout << endl;

	MaxHeap<int> maxHeap;
	maxHeap.Sort(a, N);

	cout << "***After Heap Sort***" << endl;
	maxHeap.PrintHeap(N);

	return 0;
}