Esempio n. 1
0
void fill_heap(pri_queue & q, int index, int size, int offset = 0)
{
    test_data const & data = get_data(index);

    for (int i = 0; i != size + 1; ++i) {
        q.push(data[i]);
        int top = q.top();
        q.pop();
        q.push(top);
    }
}
Esempio n. 2
0
void fill_heap_with_handles(pri_queue & q, handle_container & handles, int index, int size, int offset = 0)
{
    test_data const & data = get_data(index);

    for (int i = 0; i != size + 1; ++i) {
        handles[i] = q.push(data[i]);

        if (i > 0) {
            typename pri_queue::handle_type last = handles[i-1];
            int val = *last;
            q.erase(last);
            handles[i-1] = q.push(val);
        }
    }
}
Esempio n. 3
0
void fill_q(pri_queue & q, data_container const & data)
{
    for (unsigned int i = 0; i != data.size(); ++i)
        q.push(data[i]);
}