mkheap0.cpp

We use cookies. Read the Privacy and Cookie Policy

mkheap0.cpp

#include ‹stl.h›

#include ‹iostream.h›

int numbers[6] = {5, 10, 4, 13, 11, 19};

int main() {

 make_heap(numbers, numbers + 6);

 for (int i = 6; i ›= 1; i--) {

  cout ‹‹ numbers[0] ‹‹ endl;

  pop_heap(numbers, numbers + i);

 }

 return 0;

}