Implementation that uses dot.h interface to produce on stdout the DOT commands for a MedianSort execution. More...
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include "dot.h"
Functions | |
int | mediansort (int id, long *ar, int(*cmp)(const long *, const long *), int left, int right) |
Sort using mediansort method, generating Dotty output to generate a visualization of the sort algorithm. |
Implementation that uses dot.h interface to produce on stdout the DOT commands for a MedianSort execution.
This code is not intended to be used for sorting. Rather, it generates DOTTY output that shows the behavior of Median Sort. You have been warned. Specifically, to compute the median, this code calls qsort. Ridiculous? You bet! But it simplifies the creation of the Dotty output.
int mediansort | ( | int | id, | |
long * | ar, | |||
int(*)(const long *, const long *) | cmp, | |||
int | left, | |||
int | right | |||
) |
Sort using mediansort method, generating Dotty output to generate a visualization of the sort algorithm.
id | identifier of the graph node generated for this recursive invocation | |
ar | array of values | |
cmp | comparison function to use | |
left | The left-bounds within which to sort (0 <= left < ar.length) | |
right | The right-bounds within which to sort (0 <= right < ar.length) |
Algorithm Development Kit 1.0