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

Search:

Type: Posts; User: R1111

Search: Search took 0.02 seconds.

  1. Replies
    16
    Views
    19,167

    Re: Array to Heap Tree

    hmm why did you do "a+size" ?


    How about this? does it seem right?


    #include <iostream>
    #include <algorithm>

    void heap_sort(int* begin, int* end)
  2. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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. Replies
    16
    Views
    19,167

    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





Click Here to Expand Forum to Full Width

Featured