Search:
Type: Posts; User: laserlight
Search:
Search took 0.25 seconds.
-
It is a simpler way of writing &a[size].
It is wrong. Once you do sort_heap, the range is no longer a heap, so you cannot subsequently call push_heap with it. Furthermore, the first argument to...
-
Something like this:
#include <algorithm>
int main()
{
const int capacity = 11;
int a[capacity] = {1, 2, 3, 4, 5, 6, 7};
int size = 7;
std::make_heap(a, a + size);
-
No, that is not what it means. Rather, it states that the element at that position in the range (i.e., the range of the array, vector, etc) is inserted into the heap that consists of the elements of...
-
Simple: you pass a pointer to one past the newest array element in use as the second argument to push_heap.
Or, let me ask you: what do you understand by the statement that push_heap "inserts the...
-
There is no equivalent. You cannot increase the size of an array. As I mentioned, you could create an array as big as you will ever need then incrementally use it, but unless you have special and...
-
You cannot add values to your array because your array's size is fixed at compile time. What you can do is create an array as large as you will ever need and then just use part of it incrementally,...
-
What is the bigger picture of what you are trying to do?
Do you understand what pop_heap and push_heap do? If not, read stuff like cppreference.com's entries on pop_heap and push_heap.
-
You would only need to use make_heap, methinks. The begin/end iterators of an array would be a pointer to the first element of the array and a pointer to one past the last element of the array,...
|
Click Here to Expand Forum to Full Width
|