Hello,

If I have an array, and want to make a heap tree out of it using make heap and sort heap, how would I do it? I'm struggling because I didn't take any course in data structure.

I tried googling stuff and I got to the following:

The thing is, I don't know what's the "Iterator" doing exactly and what's begin/end, how can I use arrays with the former piece of code?

Any help -in c++- will be appreciated

If I have an array, and want to make a heap tree out of it using make heap and sort heap, how would I do it? I'm struggling because I didn't take any course in data structure.

I tried googling stuff and I got to the following:

Code:

#include <algorithm> // for std::make_heap, std::sort_heap template <typename Iterator> void heap_sort(Iterator begin, Iterator end) { std::make_heap(begin, end); std::sort_heap(begin, end); }

Any help -in c++- will be appreciated