arXiv:2410.15419cs.AIcs.SE2024-10

用执行轨迹自动分析代码时间复杂度,帮老师快速识别算法类型。

CASET: Complexity Analysis using Simple Execution Traces for CS* submissions

  • 通过动态执行痕迹和无监督学习分析算法时间复杂度
  • 可准确分类排序、搜索、动态规划等算法的复杂度等级
  • 适合需要批量评估学生代码算法能力的编程课程

在计算机科学入门或进阶课程中,最常见的自动评分方法是将学生提交的代码运行在预定义测试集上,并与参考结果对比。然而,当正确性不仅取决于输出结果,还涉及算法本身时,此方法失效。教师需手动阅读代码以判断算法类型,过程繁琐。本文提出CASET(Complexity Analysis using Simple Execution Traces),一种利用动态执行痕迹与无监督机器学习分析算法时间复杂度的新工具。CASET可帮助教师将学生提交的程序自动归类至不同时间复杂度类别,无需阅读源码即可识别其使用的核心算法。该方法可用于改进评分流程,并为采用硬编码或模式匹配等非算法策略的提交提供具体反馈。我们通过大量实验验证了CASET在排序、搜索及动态规划等典型算法上的有效性。

原文摘要 · Abstract (English)

The most common method to auto-grade a student's submission in a CS1 or a CS2 course is to run it against a pre-defined test suite and compare the results against reference results. However, this technique cannot be used if the correctness of the solution goes beyond simple output, such as the algorithm used to obtain the result. There is no convenient method for the graders to identify the kind of algorithm used in solving a problem. They must read the source code and understand the algorithm implemented and its features, which makes the process tedious. We propose CASET(Complexity Analysis using Simple Execution Traces), a novel tool to analyze the time complexity of algorithms using dynamic traces and unsupervised machine learning. CASET makes it convenient for tutors to classify the submissions for a program into time complexity baskets. Thus, tutors can identify the algorithms used by the submissions without necessarily going through the code written by the students. CASET's analysis can be used to improve grading and provide detailed feedback for submissions that try to match the results without a proper algorithm, for example, hard-coding a binary result, pattern-matching the visible or common inputs. We show the effectiveness of CASET by computing the time complexity of many classes of algorithms like sorting, searching and those using dynamic programming paradigm.

算法分析自动评分复杂度检测教育技术

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。