Skip to content

[Feature]: Empirical Asymptotic Complexity Verifier (Big-O Engine) #676

Description

@CodeSparks45

Problem Description

The project documentation correctly lists the theoretical time complexities (e.g., Bubble Sort is O(n²), Merge Sort is O(n log n)). However, there is no dynamic way to prove this to a learner on their specific hardware. An interactive educational suite should ideally allow users to empirically verify the theoretical Big-O bounds of the algorithms they are learning.

Proposed Solution

Implement a "Big-O Verification Engine" that runs algorithms at scaling input sizes to empirically calculate their growth rate.

  1. Create a benchmarking harness that takes a function pointer to a sorting or searching algorithm.
  2. Run the algorithm on randomized datasets of size N, 2N, and 4N, measuring the execution time using <time.h> (clock()).
  3. Calculate the time ratio T(2N) / T(N). If the ratio is ~2, display O(N). If the ratio is ~4, display O(N²).
  4. Render a simple text-based table in the TUI/CLI showing the input size, time taken, and the deduced empirical time complexity.

Additional Context

Suggested Labels: new feature, Hard, SSoC26


Note for Maintainers: I have cleared my previous pending assignments and my queue is empty. I am well aware of the project's strict formatting and memory safety standards. If assigned, I guarantee that I will run make fmt, make test, and make valgrind to ensure zero memory leaks and proper clang-formatting before raising the PR. Could you please assign this to me?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions