Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template pairing_heap

boost::heap::pairing_heap — pairing heap

Synopsis

// In header: <boost/heap/pairing_heap.hpp>

template<typename T,  Options> 
class pairing_heap {
public:
  // types
  typedef                                         ;      
  typedef         ;       
  typedef   ; 
  typedef     ;   
  typedef    ;  
  typedef         ;       
  typedef   ; 
  typedef           ;         
  typedef     ;   
  typedef          ;        
  typedef    ;  
  typedef  ;
  typedef       ;     

  // construct/copy/destruct
  ( = );
  (pairing_heap );
  (pairing_heap &&);
  pairing_heap & (pairing_heap &&);
  pairing_heap & (pairing_heap );
  ~();

  // public member functions
   () ;
   () ;
   () ;
   ();
   () ;
   (pairing_heap &);
   () ;
   ();
  template< Args>  ();
   ();
   (, );
   ();
   (, );
   ();
   (, );
   ();
   ();
   () ;
   () ;
   () ;
   () ;
   (pairing_heap &);
   () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;

  // public static functions
   ();

  // public data members
  static  constant_time_size;
  static  has_ordered_iterators;
  static  is_mergable;
  static  is_stable;
  static  has_reserve;
};

Description

Pairing heaps are self-adjusting binary heaps. Although design and implementation are rather simple, the complexity analysis is yet unsolved. For details, consult:

Pettie, Seth (2005), "Towards a final analysis of pairing heaps", Proc. 46th Annual IEEE Symposium on Foundations of Computer Science, pp. 174-183

The template parameter T is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options:

  • boost::heap::compare<>, defaults to compare<std::less<T> >

  • boost::heap::stable<>, defaults to stable<false>

  • boost::heap::stability_counter_type<>, defaults to stability_counter_type<boost::uintmax_t>

  • boost::heap::allocator<>, defaults to allocator<std::allocator<T> >

  • boost::heap::constant_time_size<>, defaults to constant_time_size<true>

pairing_heap public types

  1. typedef ;

    Note: The iterator does not traverse the priority queue in order of the priorities.

pairing_heap public construct/copy/destruct

  1. ( cmp = );

    Effects: constructs an empty priority queue.

    Complexity: Constant.

  2. (pairing_heap  rhs);

    Effects: copy-constructs priority queue from rhs.

    Complexity: Linear.

  3. (pairing_heap && rhs);

    Effects: C++11-style move constructor.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  4. pairing_heap & (pairing_heap && rhs);

    Effects: C++11-style move assignment.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  5. pairing_heap & (pairing_heap  rhs);

    Effects: Assigns priority queue from rhs.

    Complexity: Linear.

  6. ~();

pairing_heap public member functions

  1.  () ;

    Effects: Returns true, if the priority queue contains no elements.

    Complexity: Constant.

  2.  () ;

    Effects: Returns the number of elements contained in the priority queue.

    Complexity: Constant, if configured with constant_time_size<true>, otherwise linear.

  3.  () ;

    Effects: Returns the maximum number of elements the priority queue can contain.

    Complexity: Constant.

  4.  ();

    Effects: Removes all elements from the priority queue.

    Complexity: Linear.

  5.  () ;

    Effects: Returns allocator.

    Complexity: Constant.

  6.  (pairing_heap & rhs);

    Effects: Swaps two priority queues.

    Complexity: Constant.

  7.  () ;

    Effects: Returns a const_reference to the maximum element.

    Complexity: Constant.

  8.  ( v);

    Effects: Adds a new element to the priority queue. Returns handle to element Complexity: 2**2*log(log(N)) (amortized).

  9. template< Args>  ( args);

    Effects: Adds a new element to the priority queue. The element is directly constructed in-place. Returns handle to element. Complexity: 2**2*log(log(N)) (amortized).

  10.  ();

    Effects: Removes the top element from the priority queue.

    Complexity: Logarithmic (amortized).

  11.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue. Complexity: 2**2*log(log(N)) (amortized).

  12.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed. Complexity: 2**2*log(log(N)) (amortized).

    Note: If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

  13.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue. Complexity: 2**2*log(log(N)) (amortized).

    Note: The new value is expected to be greater than the current one

  14.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed. Complexity: 2**2*log(log(N)) (amortized).

    Note: If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

  15.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue. Complexity: 2**2*log(log(N)) (amortized).

    Note: The new value is expected to be less than the current one

  16.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed. Complexity: 2**2*log(log(N)) (amortized).

    Note: The new value is expected to be less than the current one. If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

  17.  ( handle);

    Effects: Removes the element handled by handle from the priority_queue. Complexity: 2**2*log(log(N)) (amortized).

  18.  () ;

    Effects: Returns an iterator to the first element contained in the priority queue.

    Complexity: Constant.

  19.  () ;

    Effects: Returns an iterator to the end of the priority queue.

    Complexity: Constant.

  20.  () ;

    Effects: Returns an ordered iterator to the first element contained in the priority queue.

    Note: Ordered iterators traverse the priority queue in heap order.

  21.  () ;

    Effects: Returns an ordered iterator to the first element contained in the priority queue.

    Note: Ordered iterators traverse the priority queue in heap order.

  22.  (pairing_heap & rhs);

    Effects: Merge all elements from rhs into this Complexity: 2**2*log(log(N)) (amortized).

  23.  () ;

    Effect: Returns the value_compare object used by the priority queue

  24. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  25. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  26. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  27. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  28. template<typename HeapType>  ( rhs) ;
    Equivalent comparison Returns: True, if both heap data structures are equivalent.

    Requirement: the value_compare object of both heaps must match.

  29. template<typename HeapType>  ( rhs) ;
    Equivalent comparison Returns: True, if both heap data structures are not equivalent.

    Requirement: the value_compare object of both heaps must match.

pairing_heap public static functions

  1.  ( it);

PrevUpHomeNext