1 # ifndef TPL_DYNBINHEAP_H
2 # define TPL_DYNBINHEAP_H
5 # include <tpl_binNodeUtils.H>
6 # include <tpl_binHeap.H>
25 template <
class T,
class Compare = Aleph::less<T>>
42 T & __insert(Node * p)
49 for_each_in_preorder(src.
top(),
52 this->
insert(
new Node (p->get_key()));
68 copy(const_cast<DynBinHeap&>(h));
103 T &
insert(
const T & item)
throw(std::exception, std::bad_alloc)
105 return __insert(
new Node (item));
108 T &
insert(T && item) throw(std::exception, std::bad_alloc)
110 return __insert(
new Node (std::move(item)));
122 T &
put(
const T & item)
throw(std::exception, std::bad_alloc)
127 T &
put(T && item) throw(std::exception, std::bad_alloc)
129 return insert(std::move(item));
138 T
getMin() throw(std::exception, std::underflow_error)
142 T return_value = std::move(node->get_key());
150 T
getMax() throw(std::exception, std::underflow_error)
161 T
get()
throw(std::exception, std::underflow_error)
181 Node * node = Node::key_to_node(data);
200 void remove(T & data)
216 T &
top()
const throw(std::exception, std::underflow_error)
233 template <
class Operation>
234 bool traverse(Operation & op)
236 return this->level_traverse(this->getRoot(), [&op] (Node * p)
238 return op(p->get_key());
242 template <
class Operation>
243 bool traverse(Operation && op = Operation())
248 template <
class Operation>
249 bool traverse(Operation & op)
const
251 return this->level_traverse(this->getRoot(), [&op] (Node * p)
253 return op(p->get_key());
257 template <
class Operation>
258 bool traverse(Operation && op = Operation())
const
260 return traverse<Operation>(op);
263 Functional_Methods(T);
268 # endif // TPL_DYNBINHEAP_H
T & put(const T &item)
Definition: tpl_dynBinHeap.H:122
T Item_Type
El tipo de elemento que retorna get_current().
Definition: tpl_dynBinHeap.H:34
Node * insert(Node *p)
Definition: tpl_binHeap.H:533
T & insert(const T &item)
Definition: tpl_dynBinHeap.H:103
T getMin()
Definition: tpl_dynBinHeap.H:138
Definition: tpl_sim_agent_graph.H:30
T getMax()
Definition: tpl_dynBinHeap.H:150
void empty()
Vacía todos los elementos del heap dinámico.
Definition: tpl_dynBinHeap.H:222
~DynBinHeap()
Destructor.
Definition: tpl_dynBinHeap.H:228
Definition: tpl_dynBinHeap.H:26
void erase(T &data)
Sinónimo de remove.
Definition: tpl_dynBinHeap.H:208
void update(Node *p)
Definition: tpl_binHeap.H:629
Node * top() const
Definition: tpl_binHeap.H:697
Node * getMin()
Definition: tpl_binHeap.H:589
Definition: tpl_binHeap.H:784
DynBinHeap Set_Type
El tipo de conjunto sobre el cual se itera.
Definition: tpl_dynBinHeap.H:31
void update(T &data)
Definition: tpl_dynBinHeap.H:179
T & top() const
Definition: tpl_dynBinHeap.H:216
Node * remove(Node *node)
Definition: tpl_binHeap.H:644
void remove_all_and_delete()
Definition: tpl_binHeap.H:673