CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

# Search:

Type: Posts; User: R1111

1. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

hmm why did you do "a+size" ?

#include <iostream>
#include <algorithm>

void heap_sort(int* begin, int* end)
2. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

I don't know how to deal with vectors, first encounter! I'm trying to use what I'm somewhat familiar with. I'll try to learn vectors soon.

But now I still don't get how I'll get push_heap to work...
3. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

so would it be something like this?

void add_value (double* begin, double* end)
{
push_heap(begin, end);
}

int main ()
{
4. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

Assuming that I defined a bigger array, and only a few values are associated with the first few slots. How can I add values using push_heap, if there's no equivalent to v.push_back(value) ?
5. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

well, it's confusing, there's this "v.push_back(value)" with vectors, but what's the equivalent if I'm using an array instead of a vector?
6. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

I want to add values to my array, push_heap should do it, I don't know how to use it. The example on the reference page uses vectors and "auto." Do you know what to do/how to use push_heap in a...
7. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Re: Array to Heap Tree

Thank you laserlight and ahoodin,

now I've used make_heap and sort_heap, like this:

#include <iostream>
#include <algorithm>
void heap_sort(int* begin, int* end)
{
...
8. ## Thread: Array to Heap Tree

by R1111
Replies
16
Views
1,719

### Array to Heap Tree

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...
Results 1 to 8 of 8