39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
/*----------------------------------------------------------
|
|
* HTBLA-Leonding
|
|
* ---------------------------------------------------------
|
|
* Exercise Number: S05
|
|
* Title: Bubble sort
|
|
* Author: Marc Tismonar
|
|
* ----------------------------------------------------------
|
|
* Description:
|
|
* Implements the bubble sort strategy
|
|
* ----------------------------------------------------------
|
|
*/
|
|
#ifndef ___BUBBLE_SORT_H
|
|
#define ___BUBBLE_SORT_H
|
|
|
|
#include "list.h"
|
|
#include "sorting_criteria.h"
|
|
|
|
/* NOTE: Either list or array variant is required! */
|
|
|
|
/**
|
|
* Sorts the given list according to the bubble sort strategy.
|
|
*
|
|
* @param list The list to be sorted.
|
|
* @param criterion The pointer to the function that implements the sorting criterion.
|
|
* That function accepts two integer parameters and returns a boolean value.
|
|
*/
|
|
void bubble_sort_list(IntList list, criterion_fn criterion);
|
|
|
|
/**
|
|
* Sorts the given array according to the bubble sort strategy.
|
|
*
|
|
* @param array The array to be sorted.
|
|
* @param length The length of the array.
|
|
* @param criterion The pointer to the function that implements the sorting criterion.
|
|
* That function accepts two integer parameters and returns a boolean value.
|
|
*/
|
|
void bubble_sort_array(int array[], int length, criterion_fn criterion);
|
|
|
|
#endif
|