Sorting/Longs/figure4-heapsort.c File Reference

Generate Small example(s) for heapsort. Several test cases for heapsort. Used in debug mode (step by step) when manually generating the figures in the book. More...

#include <stdio.h>
#include <assert.h>

Functions

void sortPointers (long *ar, int num, int(*cmp)(const long *a, const long *b))
 externally defined routine for sorting pointer-based values.
int cmp (const long *a, const long *b)
 Comparison function for ascending long order.
void debug (long *a, int n)
 Useful debugging function.
int main (int argc, char **argv)
 Launch the test cases.

Variables

long __swapTotal
 defined here so we can reuse code compiled for use with benchmarking.


Detailed Description

Generate Small example(s) for heapsort. Several test cases for heapsort. Used in debug mode (step by step) when manually generating the figures in the book.

Author:
George Heineman
Date:
6/15/08

Function Documentation

int cmp ( const long *  a,
const long *  b 
)

Comparison function for ascending long order.

void debug ( long *  a,
int  n 
)

Useful debugging function.

int main ( int  argc,
char **  argv 
)

Launch the test cases.

void sortPointers ( long *  ar,
int  num,
int(*)(const long *a, const long *b cmp 
)

externally defined routine for sorting pointer-based values.


Variable Documentation

long __swapTotal

defined here so we can reuse code compiled for use with benchmarking.

Algorithm Development Kit 1.0