mkheap1.cpp

We use cookies. Read the Privacy and Cookie Policy

mkheap1.cpp

#include ‹stl.h›

#include ‹iostream.h›

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

int main() {

 make_heap(numbers, numbers + 6, greater‹int›());

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

  cout ‹‹ numbers[0] ‹‹ endl;

  pop_heap(numbers, numbers + i, greater‹int›());

 }

 return 0;

}