// Sigue un min-heap paso a paso: el arreglo después de cada operación.
#include <iostream>

#include "int_heap.h"

namespace {

void print(const char* label, int value, const IntHeap& heap) {
    std::cout << label << " " << value << ": [";
    const char* separator = "";
    for (int item : heap.items()) {
        std::cout << separator << item;
        separator = " ";
    }
    std::cout << "]\n";
}

}  // namespace

int main() {
    IntHeap heap;
    for (int value : {5, 3, 8, 1, 4}) {
        heap.push(value);
        heap.check_invariants();
        print("push", value, heap);
    }
    int least = heap.top();
    heap.pop();
    heap.check_invariants();
    print("pop ", least, heap);
    return 0;
}
