Added last three homeworks

This commit is contained in:
AZEN-SGG 2025-03-02 14:38:34 +03:00
parent f7b2367bc4
commit 0e3d948c9f
363 changed files with 18214 additions and 0 deletions

14
2025.02.28/1Ex/solve.c Normal file
View file

@ -0,0 +1,14 @@
#include "solve.h"
int t1_solve(char **a, int n, char *x, int (*cmp)(const char *, const char *)) {
int avg = (n + (-1)*(n%2)) / 2;
int comp;
if (n == 0) return 0;
comp = cmp(x, a[avg]);
if (comp < 0) return t1_solve(a, avg, x, cmp);
if (comp > 0) return avg+1 + t1_solve(a+avg+1, n-(avg+1), x, cmp);
else return avg;
}