Go to the source code of this file.
static void add_to_sort_heap |
( |
int * |
heap, |
|
|
float * |
sort_values, |
|
|
int |
index, |
|
|
int |
heap_tail |
|
) |
| |
|
static |
Definition at line 42 of file heapsort.c.
48 unsigned int ifrom, ito;
55 while (ito >= 1 && sort_values[
heap[ifrom]] < sort_values[
heap[ito]]) {
static struct s_heap ** heap
static int get_top_of_heap_index |
( |
int * |
heap, |
|
|
float * |
sort_values, |
|
|
int |
heap_tail, |
|
|
int |
start_index |
|
) |
| |
|
static |
Definition at line 64 of file heapsort.c.
71 int index_of_smallest, temp;
72 unsigned int ifrom, ito, heap_end;
74 index_of_smallest =
heap[1];
80 while (ito <= heap_end) {
81 if (sort_values[
heap[ito + 1]] < sort_values[
heap[ito]])
84 if (sort_values[
heap[ito]] > sort_values[
heap[ifrom]])
95 return (index_of_smallest - start_index);
static struct s_heap ** heap
void heapsort |
( |
int * |
sort_index, |
|
|
float * |
sort_values, |
|
|
int |
nelem, |
|
|
int |
start_index |
|
) |
| |
Definition at line 13 of file heapsort.c.
21 sort_index -= start_index;
22 sort_values -= start_index;
26 for (i = 1; i <= nelem; i++)
34 for (i = nelem; i >= 1; i--)
38 sort_index += start_index;
39 sort_values += start_index;
static void add_to_sort_heap(int *heap, float *sort_values, int index, int heap_tail)
static int get_top_of_heap_index(int *heap, float *sort_values, int heap_tail, int start_index)