I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingStlAlgorithmsHeap

\\

Checks if a range is a heap or not
+ View version details

Key Facts

Gyroscopic Couple: The rate of change of angular momentum (\inline \tau) = \inline I\omega\Omega (In the limit).
  • \inline I = Moment of Inertia.
  • \inline \omega = Angular velocity
  • \inline \Omega = Angular velocity of precession.


Blaise Pascal (1623-1662) was a French mathematician, physicist, inventor, writer and Catholic philosopher.

Leonhard Euler (1707-1783) was a pioneering Swiss mathematician and physicist.

Definition

The is_heap() algorithm is defined in the standard header <algorithm> and in the nonstandard backward-compatibility header <algo.h>.

Interface

#include <algorithm>
template < class RandomAccessIterator >
    bool is_heap(
        RandomAccessIterator first,
        RandomAccessIterator last
    );
template < class RandomAccessIterator, class BinaryPredicate >
    bool is_heap(
        RandomAccessIterator first,
        RandomAccessIterator last,
        BinaryPredicate comp
    );

Parameter Description
first A random access iterator that indicates the start of a range to check for a heap
last A random access iterator that indicates the end of a range
comp A condition to test to order elements. A binary predicate takes a single argument and returns true or false

Description

Is_heap function checks if the elements in range [first, last) form a heap.

The first version compares objects using operator< and the second compares objects using a function object comp.

Return Value

Returns true if the elements in the specified range form a heap, otherwise false.

Complexity

The complexity is linear; performs at most (last - first) - 1 comparisons.