2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
13 /// Инициализировать кучу для N элементов.
14 DHeapSort::DHeapSort (int n
)
17 h
= (char **) malloc (sizeof (char *) * n
+10);
20 DHeapSort::~DHeapSort()
27 char * DHeapSort::add(char * x
)
34 /// Выбрать минимальный элемент.
35 char * DHeapSort::extract_min()
46 void DHeapSort::checkup(int c
) {
52 if (strcmp (h
[p
], h
[c
]) > 0) {
53 tmp
= h
[p
]; h
[p
] = h
[c
]; h
[c
] = tmp
;
58 void DHeapSort::checkdown(int p
)
65 if ( ((c
+1) <= size
) && strcmp (h
[c
+ 1], h
[c
]) < 0)
67 if (strcmp (h
[c
], h
[p
]) < 0) {