I have forgotten
my Password

Or login with:

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com

is_heap

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

Key Facts

Gyroscopic Couple: The rate of change of angular momentum () = (In the limit).
• = Moment of Inertia.
• = Angular velocity
• = 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.