From aaea8e86e31a92906661e1ce7cf5522740bf1b81 Mon Sep 17 00:00:00 2001 From: Selin Ayaz <selin-pinard.ayaz@etu.unistra.fr> Date: Sun, 24 Nov 2024 03:46:57 +0100 Subject: [PATCH] Doxy comments --- split-binary.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/split-binary.c b/split-binary.c index 016f0e8..bb0b753 100644 --- a/split-binary.c +++ b/split-binary.c @@ -1,16 +1,31 @@ -// Fonction récursive pour effectuer la division binaire (groupe droit plus grand) -// Fonction récursive pour effectuer la division binaire (groupe droit plus grand) +/** + * @file split-binary.c + * @brief Implements the binary split algorithm. + */ + +/** + * @brief Recursively splits the data array into two groups. + * + * This function takes a portion of the array and keeps dividing it until it can't be split further. + * + * @param array Pointer to the data array. + * @param start The starting index for the split. + * @param end The ending index for the split. + */ + + +// Recursive function to perform binary splitting (right group larger) void binary_split(Data *array, int start, int end) { - // Cas de base : si le sous-tableau contient un seul élément + // Base case: if the sub-array contains only one element if (start == end) { return; } - // Calculer l'indice du milieu, en donnant à la deuxième sous-section (groupe droit) la moitié la plus grande si impair + // Calculate the middle index, giving the second sub-section (right group) the larger half if odd int size = end - start + 1; - int mid = start + (size + 1) / 2; // Droite plus grande + int mid = start + (size + 1) / 2; // Larger right side - // Diviser récursivement les sous-groupes gauche et droit - binary_split(array, start, mid - 1); // Premier groupe (gauche) - binary_split(array, mid, end); // Deuxième groupe (droit) + // Recursively split the left and right sub-groups + binary_split(array, start, mid - 1); // First group (left) + binary_split(array, mid, end); // Second group (right) } -- GitLab