Sorting/PointerBased/bucketLinkedListSortPtr.c File Reference

Define core driver for Bucket Sort, pending the proper hash() and numBuckets() implementations, using linked lists. To employ Bucket Sort you only need to (a) provide a meaningful hash () method to return an integer given an element; and (b) provide a method to compute the number of buckets to use. This code acts as the driver and relies on external code to provide the domain-specific coding. More...

#include <stdlib.h>
#include "report.h"
#include "bucketLinkedListSortPtr.h"

Functions

void extract (BUCKET *buckets, int(*cmp)(const void *, const void *), void **ar, int n)
 One by one remove and overwrite ar.
void sortPointers (void **ar, int n, int(*cmp)(const void *, const void *))
 Invoke BucketSort on the given array.

Variables

static BUCKETbuckets = 0
static int num = 0
 Number of buckets.


Detailed Description

Define core driver for Bucket Sort, pending the proper hash() and numBuckets() implementations, using linked lists. To employ Bucket Sort you only need to (a) provide a meaningful hash () method to return an integer given an element; and (b) provide a method to compute the number of buckets to use. This code acts as the driver and relies on external code to provide the domain-specific coding.

Author:
George Heineman
Date:
6/15/08

Function Documentation

void extract ( BUCKET buckets,
int(*)(const void *, const void *)  cmp,
void **  ar,
int  n 
)

One by one remove and overwrite ar.

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

Invoke BucketSort on the given array.

Insert each element and increment counts


Variable Documentation

BUCKET* buckets = 0 [static]

int num = 0 [static]

Number of buckets.

Algorithm Development Kit 1.0