This commit is contained in:
MarcUs7i 2025-05-14 09:01:03 +02:00
parent a04a66c509
commit add23e123e
23 changed files with 1041 additions and 107 deletions

View file

@ -1,9 +1,9 @@
/*----------------------------------------------------------
* HTBLA-Leonding
* ---------------------------------------------------------
* Exercise Number: S07
* Exercise Number: S05
* Title: Sorting criteria
* Author: */<your name>;/*
* Author: Marc Tismonar
* ----------------------------------------------------------
* Description:
* Interface for sorting algorithms
@ -11,39 +11,40 @@
*/
#ifndef ___SORTING_CRITERIA_H
#define ___SORTING_CRITERIA_H
#include <stdbool.h>
/**
* Declaration of function pointer for comparison function.
* A criterion function determines whether or not the given
* values are in the order that is defined by the criterion.
*
* @param int The value that is supposed being ordered before `snd`.
* @param int The value that is supposed being ordered after `fst`.
* @return True if `fst` IS actually ordered before `snd`
* (the values are in order), false otherwise.
*/
/* Note: Name the pointer type 'criterion_fn' */
/**
* Determines whether or not `fst` is smaller than or equal to `snd` (ascending order).
*
* @param fst The value that is supposed being smaller than `snd`.
* @param snd The value to compare.
* @return True if the criterion is satisfied, false otherwise.
*/
<type> is_in_asc_order(<params>);
/**
* Determines whether or not `fst` is larger than or equal to `snd` (descending order).
*
* @param fst The value that is supposed being smaller than `snd`.
* @param snd The value to compare.
* @return True if the criterion is satisfied, false otherwise.
*/
<type> is_in_desc_order(i<params>);
#endif
#ifndef ___SORTING_CRITERIA_H
#define ___SORTING_CRITERIA_H
#include <stdbool.h>
/**
* Declaration of function pointer for comparison function.
* A criterion function determines whether or not the given
* values are in the order that is defined by the criterion.
*
* @param int The value that is supposed being ordered before `snd`.
* @param int The value that is supposed being ordered after `fst`.
* @return True if `fst` IS actually ordered before `snd`
* (the values are in order), false otherwise.
*/
/* Note: Name the pointer type 'criterion_fn' */
typedef bool (criterion_fn)(int fst, int snd);
/**
* Determines whether or not `fst` is smaller than or equal to `snd` (ascending order).
*
* @param fst The value that is supposed being smaller than `snd`.
* @param snd The value to compare.
* @return True if the criterion is satisfied, false otherwise.
*/
bool is_in_asc_order(int fst, int snd);
/**
* Determines whether or not `fst` is larger than or equal to `snd` (descending order).
*
* @param fst The value that is supposed being greater than `snd`.
* @param snd The value to compare.
* @return True if the criterion is satisfied, false otherwise.
*/
bool is_in_desc_order(int fst, int snd);
#endif