Sorting/PointerBased/straight_HeapSort.c File Reference

Generic Heap Sort implementation. A recursive Heap Sort implementation. More...

#include "report.h"

Functions

static void heapify (void **ar, int(*cmp)(const void *, const void *), int idx, int max)
 Heapify the subarray ar[0,max).
static void buildHeap (void **ar, int(*cmp)(const void *, const void *), int n)
 Build the heap from the given array by repeatedly invoking heapify.
void sortPointers (void **ar, int n, int(*cmp)(const void *, const void *))
 Sort the array using Heap Sort implementation.


Detailed Description

Generic Heap Sort implementation. A recursive Heap Sort implementation.

Author:
George Heineman
Date:
6/15/08

Function Documentation

static void buildHeap ( void **  ar,
int(*)(const void *, const void *)  cmp,
int  n 
) [static]

Build the heap from the given array by repeatedly invoking heapify.

static void heapify ( void **  ar,
int(*)(const void *, const void *)  cmp,
int  idx,
int  max 
) [static]

Heapify the subarray ar[0,max).

void sortPointers ( void **  ar,
int  n,
int(*)(const void *, const void *)  cmp 
)

Sort the array using Heap Sort implementation.

Algorithm Development Kit 1.0