From fbe11df4a8f8478ddbcd4fe8fe09d5429902e2f6 Mon Sep 17 00:00:00 2001 From: Anton Dolozin Date: Tue, 4 Nov 2025 23:42:23 +0100 Subject: [PATCH] Fixing adding problem and collisions --- du5/a_station.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/du5/a_station.c b/du5/a_station.c index 1a4daa1..080769a 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -18,7 +18,7 @@ void destroy_station(struct station* station){ int select_track(struct station* station, const char* target){ int hash = 0; for (int i = 0; i < strlen(target); i++) - { hash += target[i]; + { hash += target[i] + (hash<<6) + (hash<<16) - hash; } hash = hash %station->track_count; @@ -35,7 +35,7 @@ void add_target_capacity(struct station* station,const char* target, int capacit if(count == res){ break; } - else if (strcmp(ptr->value, target) ==0){ + else if (strcmp(ptr->value, target) ==0 ){ ptr->capacity += capacity; return; }