lemon/radix_heap.h
changeset 2114 677ea6c8169a
parent 1956 a055123339d5
child 2151 38ec4a930c05
equal deleted inserted replaced
8:7b223a9c6888 9:7dc23ade4b54
   134     /// Returns \c true if and only if the heap stores no items.
   134     /// Returns \c true if and only if the heap stores no items.
   135     bool empty() const { return data.empty(); }
   135     bool empty() const { return data.empty(); }
   136 
   136 
   137     /// \brief Make empty this heap.
   137     /// \brief Make empty this heap.
   138     /// 
   138     /// 
   139     /// Make empty this heap.
   139     /// Make empty this heap. It does not change the cross reference
       
   140     /// map.  If you want to reuse a heap what is not surely empty you
       
   141     /// should first clear the heap and after that you should set the
       
   142     /// cross reference map for each item to \c PRE_HEAP.
   140     void clear(int minimal = 0, int capacity = 0) { 
   143     void clear(int minimal = 0, int capacity = 0) { 
   141       for (int i = 0; i < (int)data.size(); ++i) {
       
   142 	iim[data[i].item] = -2;
       
   143       }
       
   144       data.clear(); boxes.clear(); 
   144       data.clear(); boxes.clear(); 
   145       boxes.push_back(RadixBox(minimal, 1));
   145       boxes.push_back(RadixBox(minimal, 1));
   146       boxes.push_back(RadixBox(minimal + 1, 1));
   146       boxes.push_back(RadixBox(minimal + 1, 1));
   147       while (lower(boxes.size() - 1, capacity + minimal - 1)) {
   147       while (lower(boxes.size() - 1, capacity + minimal - 1)) {
   148 	extend();
   148 	extend();