Intelligent Media Lab.
日本語

SOFTWARE

CodeEvaluator

Python (Streamlit)

A Streamlit-based web application that analyzes Python sorting programs and determines both the theoretical complexity order (derived by static analysis of the abstract syntax tree) and the empirical complexity order (estimated by measuring running times and fitting curves), displaying the two for comparison. It is intended for use in teaching algorithmic complexity.

Features

  • Automatic detection of sorting functions — finds the function that looks like a sort in pasted or uploaded code
  • Theoretical analysis (static) — derives the theoretical order by composing nested loops, update patterns of while loops, and the implicit cost of calls such as sorted() and heapq, and presents the reasoning (in Japanese) with a confidence level. Recursion is solved with the general master theorem, and loops whose variables change geometrically, as in shell sort, are classified by symbolic loop analysis with sympy. Best, average and worst cases are shown
  • Empirical analysis (benchmark) — measures running time over geometrically increasing input sizes, fits candidate models by least squares (model selection by AIC), and reports the measured exponent from log-log regression. Orders are determined separately for random, sorted and reversed inputs, so input-dependent behavior such as the best case of insertion sort or the worst case of quicksort can be confirmed
  • Plots and overall verdict — overlays fitted curves on a log-log plot and reports whether theory and measurement agree

Start with streamlit run app.py, paste a sorting algorithm into the browser page to see the theoretical analysis, and press “Run benchmark” to start the empirical analysis.

Caution: the app actually executes the Python code it is given. Basic protections such as timeouts and process isolation exist, but it is not a sandbox, so analyze only code you trust. See the GitHub repository for details.

← Back to list