示例#1
0
void PerformHeapOperations(shared_ptr<IHeap> heap, int* arr, int n)
{
    heap->BuildHeap(arr, n);

    cout << "heap array (before)   : ";
    for (int i = 0; i < n; i++)
        cout << arr[i] << " ";
    cout << endl;
    cout << "heap array (after)    : ";
    heap->Print();

    cout << "heap array (sorted)   : ";
    heap->Sort();
}