Skip to content

Instantly share code, notes, and snippets.

View enderavour's full-sized avatar

enderavour enderavour

View GitHub Profile
@enderavour
enderavour / radix.rs
Created March 15, 2026 12:43
Implementation of Radix Sort in Rust
use std::cmp::Ord;
use std::ffi::{c_int, c_ulong, c_void};
use std::time::{SystemTime, UNIX_EPOCH};
use std::error::Error;
// Note: Sometimes due to initialization artifacts zeros occur between sorted numbers
fn radix_sort<'a, T>(arr: &'a mut [T]) -> &'a [T]
where T:
Ord + Clone + Copy + Into<u64>
@enderavour
enderavour / knn.c
Last active February 17, 2026 13:04
Implementation of K-Nearest Neighbors algorithm in C
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct
{
int32_t k;
double **x_train;
double *y_train;
@enderavour
enderavour / horspool.c
Created October 29, 2025 09:32
Implementation of strstr function using Boyer-Moore-Horspool algorithm
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
char *strstr(const char *string1, const char *string2)
{
if (!string1 || !string2)
return NULL;
size_t text_len = strlen(string1);