Skip to content

Latest commit

 

History

History
95 lines (61 loc) · 4.44 KB

File metadata and controls

95 lines (61 loc) · 4.44 KB

⚠️ MIGRATION NOTICE

The Kafka Client Framework ("StreamKernel") has moved.

This repository is now dedicated exclusively to Algorithmic Benchmarking and Computer Science Fundamentals (Big O Analysis).

If you are looking for the High-Performance Kafka Source/Sink Framework, DLQ patterns, or SPI implementation, please update your bookmarks and stars to the new location.


Algorithm Arena ⚔️

Architected by Steven Lopez

A Modern Java 21 Data Structures & Algorithms Benchmarking Framework

"Theory tells you O(N log N) is fast. The Arena shows you how fast."

🚀 Overview

Algorithm Arena modernizes classic CS concepts using Java 21 features such as Records, Pattern Matching, Sealed Classes, and Virtual Threads.

At its core is a Polymorphic Benchmarking Arena that compares algorithms in real time, validating theoretical Big‑O performance against real execution behavior.


🌟 Unique Features

1. Complexity Contracts (BigOSort)

Every sorting algorithm extends the BigOSort base class and must declare its best/average/worst-case time complexity and space complexity (bigOContract()), so the Big-O numbers ship alongside the implementation instead of living only in comments.


2. Sorting Arena (SortingComparison)

Benchmark 14 sorting algorithms under controlled conditions.

Includes:

  • Identical randomized datasets
  • Millisecond/microsecond timers
  • Automatic sorting verification (isSorted() check after every run)

3. Search Arena (SearchComparison)

The same contract-and-benchmark pattern as sorting, applied to search: BigOSearch declares each algorithm's complexity, and SearchComparison runs Linear/Binary/Jump search against an identical dataset, verifying both a present and an absent target.


4. Empirical Scaling Proof (ScalingBenchmark)

SortingComparison proves correctness at one size; ScalingBenchmark proves the growth rate is real by timing every sort across five input sizes (1k → 16k) and printing the runtime ratio between each doubling. O(n²) algorithms trend toward a ~4x ratio, O(n log n) toward ~2x, and O(n + k) algorithms stay roughly flat — so the Big-O label isn't just a string, it's something you can watch happen.

./gradlew run -PmainClass=com.example.arena.sorting.ScalingBenchmark

5. Automated Test Suite (JUnit 5)

Correctness isn't just eyeballed from console output — src/test/java (269 tests) validates every sorting algorithm, every search algorithm, the graph traversal/shortest-path algorithms, the Fibonacci implementations, and every data-structure sample's Big-O contract against a battery of edge cases (empty, single-element, duplicates, negative numbers, already sorted, reverse sorted, unreachable nodes, large random input) and fails the build on any mismatch.

./gradlew test

📚 Reference Index

Topic Package Contract / Runner
Sorting (14 algorithms) sorting.algorithms BigOSort / SortingComparison, ScalingBenchmark
Searching (Linear, Binary, Jump) search.algorithms BigOSearch / SearchComparison
Data structures (array, list, stack, queue, hash table/map/set, heap, matrix, BST, graph, weighted graph) datastructures BigODataStructures / DataStructureShowcase
Graph traversal (BFS, DFS) & shortest path (Dijkstra) datastructures.GraphSample, datastructures.WeightedGraphSample
Recursion vs. Dynamic Programming (Fibonacci: naive/iterative/memoized) numbersequences FibonacciComparison
Sliding window, two pointers, top-K algorithms
Classic interview problems (trapping rain water, merge intervals, group anagrams) hackerrank
Generic Java-language demos (inheritance, static usage, singleton patterns, streams, production-incident debugging) javafundamentals Kept separate from the CS-fundamentals content above

🏁 Final Notes

Algorithm Arena is a blend of:

  • Algorithm benchmarking
  • Automated correctness validation
  • Modern Java 21 exploration

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

Author: Steven Lopez