ADS
Algorithms and Data Structures
Toggle main menu visibility
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
74
namespace
ADS
75
{
76
77
/*--------------------------------------------------------------------------*/
78
97
template
<
class
T ,
class
C = std::less<> >
98
void
maxHeapSiftUp
( std::vector< T > & A , std::size_t i , C less = C() );
99
112
template
<
class
T ,
class
C = std::less<> >
113
void
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
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Heapsort.h
The max-heap on a vector and heapsort (section 10.1.4): the children of the place are and ,...
ADS::maxHeapSiftUp
void maxHeapSiftUp(std::vector< T > &A, std::size_t i, C less=C())
up in the heap , with the order less; time
ADS::heapBuildByInsertion
void heapBuildByInsertion(std::vector< T > &A, C less=C())
made a max-heap by inserting its items one at a time; time
ADS
Definition
ADT.h:96
ADS
tree
HeapByInsertion.h
Generated by
1.17.0