ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
HeapByInsertion.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------- File HeapByInsertion.h -------------------------*/
3/*--------------------------------------------------------------------------*/
50/*--------------------------------------------------------------------------*/
51/*----------------------------- DEFINITIONS --------------------------------*/
52/*--------------------------------------------------------------------------*/
53
54#ifndef __ADS_HeapByInsertion
55 #define __ADS_HeapByInsertion
56/* self-identification: #endif constant */
57
58/*--------------------------------------------------------------------------*/
59/*------------------------------ INCLUDES ----------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#include "ADS/Contract.h"
63#include "ADS/sort/Heapsort.h"
64
65#include <cstddef>
66#include <functional>
67#include <utility>
68#include <vector>
69
70/*--------------------------------------------------------------------------*/
71/*--------------------------- NAMESPACE ------------------------------------*/
72/*--------------------------------------------------------------------------*/
73
74namespace ADS
75{
76
77/*--------------------------------------------------------------------------*/
78
97template< class T , class C = std::less<> >
98void maxHeapSiftUp( std::vector< T > & A , std::size_t i , C less = C() );
99
112template< class T , class C = std::less<> >
113void heapBuildByInsertion( std::vector< T > & A , C less = C() );
114
115/*--------------------------------------------------------------------------*/
116
117} // end( namespace ADS )
118
119/*--------------------------------------------------------------------------*/
120/*-------------------------- IMPLEMENTATION --------------------------------*/
121/*--------------------------------------------------------------------------*/
122
123#include "ADS/tree/impl/HeapByInsertion.tpp"
124
125/*--------------------------------------------------------------------------*/
126
127#endif /* HeapByInsertion.h included */
128
129/*--------------------------------------------------------------------------*/
130/*----------------------- End File HeapByInsertion.h -----------------------*/
131/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The max-heap on a vector and heapsort (section 10.1.4): the children of the place are and ,...
void maxHeapSiftUp(std::vector< T > &A, std::size_t i, C less=C())
up in the heap , with the order less; time
void heapBuildByInsertion(std::vector< T > &A, C less=C())
made a max-heap by inserting its items one at a time; time
Definition ADT.h:96