Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Array and Hashing Patterns: Two Pointers, Sliding Window, Prefix Sum and Frequency Maps
Computing once and keeping what a nested loop recomputes takes two sum from O(n²) to O(n): on 100,000 prices brute force takes 1.69 seconds and the Dictionary version 0.32 ms. We cover frequency maps and CountBy, two pointers, fixed and variable-width sliding windows, a rate limiter tested with TimeProvider, and counting ranges that sum to k with a prefix sum plus a Dictionary, all with xUnit tests.
How Hash Tables Work: Writing Your Own HashMap in C#, Collisions and Load Factor
A hash table computes a bucket index from the key's hash code and resolves collisions with chaining or open addressing; a GetHashCode that always returns 42 makes a 10,000-key Dictionary 967 times slower. We write our own HashMap with the same internals as .NET's Dictionary (buckets + entries, free list, prime sizes), linear probing with tombstones, look at randomized string hashing and build a Bloom filter, all with xUnit tests.