WorksComputer Science
Augmented Algorithm: Generating Interactive Algorithm Visualizations from Static Textbook Pseudocode
Abstract
Learning data structures and algorithms is a fundamental activity in computer science education, but this is challenging due to their abstract and dynamic nature. While algorithm visualization tools have shown pedagogical benefits, they remain underutilized in educational settings due to creation or integration difficulties. We introduce Augmented Algorithm, a novel LLM-powered algorithm visualization tool that transforms static textbook pseudocode into embedded, interactive algorithm visualizations. Our web-based system combines computer vision with LLMs to automatically generate synchronized, step-by-step algorithm animations from pseudocode directly within scanned textbook pages. We evaluated \sys through technical evaluation, a usability study with students (N=15), and expert interviews with instructors (N=6). Results show that our system significantly reduces algorithm visualization development and access effort while enabling more interactive and tailored learning experiences for algorithmic concepts. All supplemental materials required to reproduce the study are available on https://osf.io/5xrmy.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].
Conference acronym ’XX, Woodstock, NY
© 2018 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM ISBN 978-1-4503-XXXX-X/2018/06
https://doi.org/XXXXXXX.XXXXXXX
CCS Concepts
• Applied computing → Interactive learning environments; • Human-centered computing → Mixed / augmented reality.
Keywords
algorithm visualization, data structures and algorithms, pseudocode
ACM Reference Format:
Yuki Ueno, Zhuojun Jiang, and Chris Bryan. 2018. Augmented Algorithm: Generating Interactive Algorithm Visualizations from Static Textbook Pseudocode. In Proceedings of Make sure to enter the correct conference title from your rights confirmation email (Conference acronym ’XX). ACM, New York, NY, USA, 16 pages. https://doi.org/XXXXXXX.XXXXXXX
Introduction
Data Structures and Algorithms (DSA) are a cornerstone of computer science practice. However, learning and applying algorithmic strategies is not easy because it involves abstract concepts that are often invisible and dynamic in nature [18]. As a result, the static presentations of algorithms commonly found in textbooks – such as textual explanations and static diagrams – often fall short in conveying the underlying logic and temporal behavior of algorithms.
To support a better understanding of DSA, researchers have been studying algorithm visualization (AV) [19, 46]. AV tools graphically represent the concepts of DSA to allow learners to observe their step-by-step execution [23, 46]. Prior studies have shown that achieving AV success in education is non-trivial (see § 2.1), in part because many prior AV tools have been designed as bespoke artifacts and aligning them with course-specific content is time-consuming and technically demanding for educators [40, 45]. Such tools are also generally external and disconnected, requiring students to switch between visualizations and course materials, which increases cognitive load and disrupts the continuity [38]. As a result, AV tools continue to remain underutilized in real-world educational settings, despite their potential pedagogical benefits such as promoting student engagement and hands-on learning [18, 30, 45].
In this paper, we investigate how to address these challenges by designing and implementing Augmented Algorithm, a novel tool that transforms static pseudocode (e.g., such as from textbooks or lecture slides) into interactive step-by-step animations. By leveraging a multi-stage pipeline based on Large Language Models (LLMs), our system parses pseudocode and generates corresponding executable code in Python and JavaScript. It then simulates algorithm execution on user-definable inputs and produces synchronized animations visualizing the associated data structures.
While creating AV from static documents is not new (e.g., the DARA system [41]), we contribute in three key ways related to the design and development of novel user interfaces and user experiences (UIs/UXs) for AV learning. First, unlike DARA, which requires real Java code printed in static documents (with custom labels) and supports only Dijkstra’s algorithm, our approach supports several fundamental DSAs directly from printed pseudocode, eliminating the need for real code preparation and supporting breadth.
Second, to motivate the development of our system, we conduct a design strategy and requirements analysis to identify design challenges and goals related to successful UI/UX workflows for AV student learning. Based on these, we inform a backend pipeline and set of UI/UX interaction features tailored for such AV learning.
Third, we contribute insights from three evaluations on the feasibility and utility of our approach via direct manipulation of static pseudocode: a technical evaluation of the system’s accuracy and output quality, a student-focused usability study (N=15), and expert interviews with DSA instructors (N=6).
Our technical evaluation results demonstrate the system’s robustness, achieving over 94% accuracy in pseudocode extraction and 100% accuracy in analyzing time and space complexity and code generation, with generated AVs receiving high scores for execution fidelity, data encoding, and visualization type selection. The student-focused study confirms the high usability and engagement of this system compared to traditional, static learning approaches (e.g., textbooks). The expert interviews validate our approach against existing teaching materials and explore its integration into current educational practices. Overall, evaluation feedback suggests that our approach can reduce AV preparation and integration workload and encourage learners’ in-depth understanding and engagement. Based on the process of designing, implementing, and evaluating Augmented Algorithm, we reflect on insights and lessons learned and discuss areas for future enhancement as well as the implications that technology-enhanced tools like Augmented Algorithm have for the future of learning and teaching.
Related Work
Algorithm Visualization
Traditionally, static materials (e.g., textbooks, lecture slides) are the primary resources used for presenting content in DSA courses. Unfortunately, students often struggle to connect static pseudocode with dynamic execution behavior [18].
Algorithm Visualization (AV) represent one possible solution for this, by using graphical representations of data structures and allowing users to execute algorithms step-by-step through interaction and animation [6, 29, 46]. While early literature reported mixed results on the pedagogical effectiveness of AV [29], subsequent work has demonstrated its potential benefits [20, 53, 58], including improved learning outcomes [18, 25, 32, 43] and engagement [24].
Motivated by this, researchers have developed several examples of AV tools (e.g., [1, 14, 15, 19, 42, 46, 52]). Unfortunately, adopting such tools in practice is non-trivial. Such tools are not easy to integrate into existing pedagogical course materials (e.g., students must switch from an existing resource such as a textbook to an external AV tool, which can increase cognitive load and disrupt the continuity of the learning experience [38]), or must use specialized/-tailored teaching materials (e.g., interactive AVs can be embedded into e-textbooks, but this restricts the content to only the supported digital resources). Likewise, external tools may have inconsistent notations or implementation details compared to existing curriculum resources (e.g., textbook pseudocode) [45]. As such, educators often hesitate to use external “standalone” or “resource-restricted” tools in classroom settings [40, 45].
In contrast to this “external” or “resource restricted” approach, we contribute a flexible and integrative approach for generating AVs directly from pseudocode found in static materials that already exist in DSA courses. In part, because we employ an LLM and mixed reality approach to read and parse pseudocode, we can accommodate different notations (that trip up existing AV tools) while also supporting existing curriculum materials.
Augmenting Static Documents
Making static resources interactive and explorable is an ongoing goal in technology-enhanced learning. For example, prior work has developed techniques to augment documents with semi-automatically generated summaries [9], references [35], highlights [10, 17, 34], annotations [27, 31, 50], and visualizations [2, 37, 48]. Systems like Augmented Math [11] and Augmented Physics [21] extend this line of work by transforming diagrams into interactive, animated media. While we share the goal of making documents interactive, our work significantly differs in the type of content we augment and the inherent challenges: prior research has largely focused on descriptive content (e.g., explaining what a system is), whereas we focus on procedural content that explains how to perform a process, such as an algorithm, or represent the content of a data structure.
The most relevant prior work in this area is DARA [41], a system that uses mobile AR to recognize and visualize Dijkstra’s algorithm from a printed page. This work shares our objective of performing AV based on static (printed) materials. However, DARA’s approach is limited in generalizability and scalability. As mentioned above, it only works on Dijkstra’s algorithm; it also requires pre-placed markers on the printed material, and overlay content must be manually prepared beforehand. In contrast, our system employs a markerless approach that analyzes pseudocode directly from unmodified textbooks on-the-fly and then dynamically generating visualizations. This approach is also more generalizable, by allowing the transformation of any existing DSA textbook into an interactive learning experience across a wide range of common algorithms.
Automated Visualizations
Previous research in AV has examined varying degrees of automation in mapping algorithmic procedures to visual representations [33]. Early systems [3, 12, 39] reduced manual coding effort by either offering semi-automated visualization semantics or introducing specialized pseudocode languages. These approaches tightly coupled to the syntactic structure of algorithmic implementations rather than their semantic significance.
More recently, the emergence of LLMs has supported the flexible and expressive creation of visualizations via natural language. So-called Natural Language to Visualization (NL2VIS) systems [16, 51, 54] generate complete visualization code directly from high-level natural language queries, primarily for tabular data.
Our work extends this line of research by applying LLM-based visualization generation in the context of AV. Inspired by the notion of Interesting Events introduced by BALSA [6, 7], our pipeline generates executable code with embedded visualization triggers based on parsing pseudocode. Unlike traditional approaches that mechanically map code operations to visual effects, we employ LLMs to semantically analyze algorithmic procedures and strategically insert visualization commands at points judged significant, independent of the specific syntactic operations in the code. This approach enables the generation of more contextually appropriate visualizations that highlight the conceptual essence of algorithms rather than merely reflecting their implementation details.
Design Challenges and Goals
As discussed in § 1 and § 2, AV tools are often external and disconnected from traditional course materials, not to mention they have limited flexibility to work with a variety of DSA content notations (e.g., variations in pseudocode or algorithm implementation details) that are found in CS curricula. To address these issues, we employ a design methodology [44] to design, engineer, and evaluate Augmented Algorithm. In alignment with design study practices, we first considered the design challenges and goals of such a potential tool. To distill a set of design challenges, we performed a meta-analysis of existing AV tools based on the literature discussed in § 2, reviewing their current limitations and how these could be addressed. From this, we derived a set of five salient design challenges C1–C5:
C1 Lowering the Barrier for Instructor Adoption: A major barrier to adopting AVs in classroom is the difficulty of finding or creating suitable animations or presentations that align with course content [40, 45]. Instructors need mechanisms that minimize the effort required to prepare effective AVs for their specific curriculum.
C2 Seamless Integration with Existing Learning Materials: For widespread adoption, AV tools should integrate seamlessly with existing materials like textbooks and lecture notes [45], as discrepancies between tool examples and course materials can cause confusion and disrupt learning flow [40].
C3 Creating Effective and Engaging AVs: For an AV to be pedagogically effective, it must not only visually represent the algorithm but also actively engage the learner [29]. Following established best practices for AV design [40], visualizations should provide elements that promote hands-on engagement and interaction, rather than passive observation.
C4 Diverse Programming Language Backgrounds: While DSA is language-agnostic, algorithms are often taught in specific programming languages (e.g., Python, Java, C++). Tools fixed to an unfamiliar language impose a dual cognitive load of learning both the algorithm’s logic and language syntax. Therefore, learners need a flexible environment that lets them focus on the algorithm using a language they are already proficient in.
C5 Preserving Learner Agency: While generated code and visualizations are convenient, they should not be unmodifiable “black boxes.” Related to C3, there is strong evidence for the benefits of experiential learning through active participation [28, 29], such as students modifying a data structure and observing cause and effect on the algorithm’s results and runtime. The challenge is to balance the convenience of automation while ensuring learners retain agency to edit and experiment with the code.
Then, to address the design challenges C1–C5, we derived a set of five corresponding design goals G1–G5:
G1 Automated Algorithm Visualization Generation: To lower the barrier for instructor adoption (C1), we aim to automatically generate AVs directly from static pseudocode, eliminating the need for instructors to manually create or search for suitable animations, thus streamlining the integration of AVs into their curriculum.
G2 Tightly-Coupled Learning Material Integration: To ensure seamless integration with existing curriculum materials (), we aim to overlay AVs directly onto existing materials such as static textbooks or lecture slides, coupled with UI/UX features such as interactively animating the AV execution paired with code highlighting and variable tracing to bridge the gap between abstract pseudocode and its concrete execution.
G3 Pedagogically Sound Visualizations: To create effective and engaging learning experiences (), we want AVs to be guided by established visualization design practices [40], focusing on principles such as “provide multiple views,” “support flexible execution control,” and “complement visualizations with explanations,” to encourage active exploration rather than passive observation.
G4 Multi-Language Support: To accommodate learners from diverse programming backgrounds and reduce cognitive load from unfamiliar syntax (), we aim to support multiple programming languages by decoupling the executable algorithm code from its visual representation, allowing students to engage with the material in a familiar programming environment.
G5 Flexible Editing of Algorithm Visualization: To preserve learner agency () and foster deeper engagement (), we intend to provide flexible editing capabilities, such as allowing users to directly modify the algorithm, the visualization code, and the input datasets. This empowers them to correct auto-generation errors, explore “what-if” scenarios, and even construct their own visualizations, an activity known to enhance learning [49].
System Design and Implementation
Augmented Algorithm is a web-based, LLM-integrated AV tool designed to fulfill –. It supports DSA learning by transforming static pseudocode into interactive, step-by-step AVs, allowing users to explore algorithm execution, performance metrics, and data structure transformations in real time. Below, we describe the system architecture and interface design details of Augmented Algorithm; evaluations are presented in § 5 and § 6. To support reproducibility, the system’s codebase is available at <GitHub link anonymized for review round>.
Learning Workflow
To help scope the workflows enabled by our system, consider the DSA topics that are commonly taught in CS curriculums, such as sorting algorithms, linked list data structures, and binary search tree operations. An example learning workflow for these using Augmented Algorithm can comprise the following steps: 1) capture (or upload) an image of a curriculum material (e.g., a textbook page, lecture slide, PDF handout, etc.), 2) highlight the pseudocode and select the desired programming language, 3) generate and execute an AV instance, and 4) support follow-up learning and exploration via interactions with the AV. Below, we illustrate this workflow using a bubble sort example from Introduction to Algorithms [13], one of the most popular university-level introductory DSA textbooks in the United States. Figure 1 illustrates this walkthrough.

Figure 1. An example of using Augmented Algorithm to transform a static textbook algorithm into executable code and dynamic visualizations. (a) The user selects pseudocode by drawing a box around it. (b) A language panel allows them to choose a programming language. (c) The generated algorithm visualization is displayed in a movable window. (d) Stepping through the algorithm execution highlights the current line, with variable values shown inline. (e) Input arrays can be captured directly from the page. (f) For detailed review and exploration, a code editor supports customization of the algorithm and visualization. (g) Time and space complexities are shown as a line chart.
Step 1: Capture or Import a DSA Page: A user first captures a snapshot of a static DSA resource (e.g., a textbook page) and imports it into Augmented Algorithm either via a camera on the user’s laptop/tablet or by importing a PDF or other image file format. The snapshot is converted to a standardized image format for processing. The system performs layout detection using OCR and computer vision to extract pseudocode, and overlays bounding boxes on detected pseudocode regions to guide user selection in the subsequent step ().
Step 2: Select Pseudocode and Programming Language: The user next selects the pseudocode by adjusting a bounding box using corner handles to encompass the entire code block (Figure 1-a) and chooses a programming language for code generation from two supported options: Python or JavaScript () (Figure 1-b).
Step 3: Generate and Execute an Algorithm Visualization Instance: The system converts selected pseudocode into executable code for the selected programming language, injected with additional AV commands (). Specifically, the generated code incorporates hook functions that visualize dynamic representation of algorithmic operations and data structure modifications. The code is processed through a visualization engine to produce JSON-formatted commands defining animation sequences, timing, and visual effects, which are rendered into an interactive algorithmic demonstration to the user (Figure 1-c), along with visualizations of worst-case time and space complexity alongside the animation () (Figure 1-g).
Step 4: Supporting Interactions with the Algorithm Visualization: Several features support further interaction and editing. Animation can be triggered to observe additional synchronized overlays on the original pseudocode (i.e., on the textbook), including code-line highlighting and variable tracing, which supports step-by-step exploration of algorithmic execution (, ) (Figure 1-d). The AV can be played with default randomized datasets or user-provided inputs. A capture function lets users to extract numerical values or arrays directly from DSA resources (e.g., other textbook pages) via OCR and use them as input data (Figure 1-e), and an integrated code editor allows further modification of the algorithm and visual representation (, ), if desired (Figure 1-f).
System Architecture and Pipeline
The system comprises three main components: frontend, backend, and visualization engine. The frontend is implemented using React.js and D3 [4] for dynamic visualization rendering. The backend is implemented using FastAPI1 to orchestrate core system functionalities, including OCR processing for textbook analysis and LLM integration for automatic code generation. For textbook analysis, we employ Google Cloud Vision API2 for text extraction and Layout-Parser [47] for detecting pseudocode regions. For code generation, we utilize LangGraph3 to implement the AV Code Generator, coordinating multiple LLM-based agents to transform pseudocode into executable algorithms with integrated visualization hooks. The visualization engine operates as a serverless AWS Lambda4-based execution environment supporting multiple programming languages. This component executes the generated algorithm code and produces JSON-formatted visualization commands. An overview of the main system architecture is shown in Figure 2; we detail the steps below.
Figure 2. An overview of the Augmented Algorithm system architecture.
Pseudocode Extraction: The system first processes the captured content (e.g., a PDF or image input) by first converting it into a standard image format for layout analysis. It then applies LayoutParser [47] to segment documents into structural elements such as text, title, list, table, and figure. The system filters for list, table, or figure elements, as these frequently contain pseudocode. The bounding box coordinates of these candidate regions are returned to the frontend, which overlays rectangular highlights on the textbook to assist users selection. Once a region is selected, the system captures the pseudocode within that region and converts it to textual data using Google Cloud Vision API. This OCR processing transforms the visual pseudocode representation into text format, enabling the subsequent analysis and code generation processes.
AV Code Generation: The AV Code Generator component receives the pseudocode text and then initiates the process to generate AV code. Specifically, this component comprises four LLM-powered modules: pseudocode analysis, executable code generation, visualization type selection, and visualization command injection, orchestrated using LangGraph (Figure 3). We strategically employ different LLM models based on task complexity: GPT-5 nano5 for lightweight analysis tasks (pseudocode analysis and visualization type selection), and Claude Sonnet 46 for complex code generation tasks (executable code generation and visualization command injection).
Figure 3. The AV Code Generator pipeline for generating executable visualization code.
The pseudocode analysis module analyzes the textual pseudocode to infer 1) the algorithm name, 2) required input parameters, and 3) time/space complexity. The executable code generation module produces runnable code in the user’s selected programming language that faithfully implements the analyzed pseudocode. To ensure code reliability, this module incorporates a reflection mechanism that automatically detects and corrects execution errors through iterative debugging. These outputs are then passed to the visualization type selection module, which determines the most appropriate visualization type (e.g., one-dimensional arrays, bar charts, linked lists, and tree node-link diagrams, see Figure 4) based on the algorithm’s data manipulation patterns. Finally, the visualization command injection module (which also includes a reflection mechanism) inserts visualization functions at points where interesting events occur.

Figure 4. Visualization windows showing frame-by-frame animation controls.
Visualization Command Extraction and Serialization: The Visualization Engine executes the generated code within a Lambda environment corresponding to the specified programming language, capturing visualization commands during algorithm execution. Each visualization operation is intercepted and converted into structured JSON commands that encode the operation type, target elements, and parameters. This standardized JSON format is language-agnostic, enabling the frontend to process visualization commands uniformly regardless of the underlying programming language. Each command contains three components: a key for visualization instance identification, a method name for the visualization operation, and an arguments array containing method parameters. This format enables deterministic reconstruction of the visualization sequence in the frontend.
AV Rendering: Finally, the frontend receives the JSON command sequence and processes it through a command interpreter that maps operations to data manipulation functions. The system maintains internal data structures bound to visualizations through D3 data joins. Command execution updates the internal data model, triggering D3’s data-driven rendering to generate animations. Each command corresponds to specific visual changes, maintaining synchronization between algorithm execution and display. The frontend panel provides a set of interactive playback controls, allowing users to navigate the command sequence at variable speeds, pause at algorithmic steps, or advance frame by frame.
AV Interaction Features
To support our learning workflow, we design and integrate a set of interactive functionalities in Augmented Algorithm, including interactive frame-by-frame animation, dynamic input, synchronized code-line highlighting, variable tracing, and time/space complexity visualization. Together, these features transform static pseudocode into a dynamic and exploratory environment, enabling learners to observe algorithm behavior in real time and engage directly with both code and data.
Interactive Frame-by-Frame Animation: Animation has been shown to be an effective mechanism for explanatory visualization [36], hence we employ it here. This feature allows learners to follow and control an algorithm’s execution step by step, supporting agency in observing both the algorithm progression and changes in data structures over time via Play, Next, and Previous controls. Figure 4 shows examples of how the system supports three common data structures: 1) one-dimensional arrays, 2) linked lists, and 3) trees. (The system is also extensible to support additional data structures and algorithms; see § 7.) Arrays are displayed in a grid layout with bar charts for numerical data; linked lists show nodes connected by directional arrows with pointer indicators; and trees are rendered using hierarchical layouts. During animation, each visualization supports dynamic operations such as value modification, element highlighting, and node/edge insertion or deletion.
Dynamic Input: Users can provide custom input values through manual entry via input forms or direct capture from textbook examples using the integrated capture function. This dual approach allows learners to test textbook scenarios or any values they wish to explore, providing a scaffold for experiential learning about algorithm behavior under different conditions, and support tightly-coupled integration that leads to the automatic generation (or updating) or AVs. The system by default supports three input types: single numerical values, one-dimensional arrays, and two-dimensional arrays, though, similar to the data structured mentioned above, the system is extensible for additional input types. Figure 5 shows an example of how users can update an input array by entering values in the form or capturing data directly from a textbook example.

Figure 5. An example of dynamically inputting data structure values.
Synchronized Code-Line Highlighting: During animation, the currently executing line of pseudocode is dynamically highlighted on the resource image (i.e., the textbook page). This real-time synchronization enables learners to see exactly how each line of code translates into algorithmic actions, with the goal of making abstract algorithmic concepts immediately apparent in terms of code execution. For example, Figure 6 illustrates this feature. The executed lines (Lines 3 and 4) are indicated with a semi-transparent pink rectangle, and the highlight dynamically shifts as the animation advances through each step of the algorithm.

Figure 6. Synchronized code-line highlighting and variable tracing.
Variable Tracing: Variable values are overlaid on the pseudocode and dynamically update as the algorithm executes. The goal is to provide learners with an intuitive understanding of how data evolves and flows at each step. For example, Figure 6 illustrates variable tracing, where each variable is annotated with its current value inside a semi-transparent blue rectangle. With these overlaid values, learners can clearly see that at Line 3, the condition A[2] (= 2) < A[1] (= 5) evaluates to true, and at Line 4, the values of A[2] (= 2) and A[1] (= 5) are exchanged.
Time/Space Complexity Visualization: Finally, the system presents theoretical performance metrics, including time and space complexity in Big-O notation, with a static visualization of worst-case scenarios to help learners understand the theoretical upper bounds of algorithm performance and resource usage. For example, Figure 7 illustrates the time and space complexity of bubble sort.

Figure 7. The time/space complexity visualization window.
Technical Evaluation
To evaluate the computational accuracy and quality of our backend pipeline, we collected 23 DSA textbooks and randomly selected 10 pseudocode examples each for insertion sort, linked-list traversal, and binary search tree search. We applied our pipeline to each sample and evaluated the correctness and quality of the generated animations using a hybrid automatic and manual assessment.
For accuracy evaluation, we considered three aspects. First, we measured the character error rate (CER) for pseudocode OCR detection. Specifically, we computed the Levenshtein distance between the OCR output and the ground-truth pseudocode and defined accuracy as:
Second, we assessed the accuracy of time and space complexity analysis by comparing LLM predictions against ground-truth complexity from the textbooks, calculating the proportion of correctly matched results. Third, we evaluated the correctness of the generated executable algorithm code (i.e., prior to the injection of visualization commands) using unit tests and manual verification. Due to the wide syntactic variation in pseudocode (e.g., Python-like syntax, natural-language-based syntax), one of the authors, who had completed an advanced data structures and algorithms course, manually verified that generated code preserved the structure and semantics of the original pseudocode, while unit tests ensured correct execution.
Next, to assess the quality of generated AVs, we designed an animation rubric encompassing Execution Fidelity, Data Encoding, Visualization Type, and Aesthetics (Table 1), as no standardized method exists for evaluating AVs. To minimize individual bias, two authors independently rated each animation using a 5-point scale (1=poor, 5=excellent), and the final score was computed as the average of their ratings.
| Dimension | Question |
| Execution Fidelity | Are all algorithmic steps executed correctly and in proper sequence, without omissions or hallucinations? |
| Data Encoding | Does the visualization accurately reflect the data structure state at every algorithmic step? |
| Visualization Type | Considering the algorithm’s features, is the visualization type appropriate for representing the algorithmic process? |
| Aesthetics | Are the aesthetics of the visualization elements (color, shape, position) appropriate and effective for the algorithm? |
Table 1. Evaluation rubric for assessing AV quality.
Table 2 summarizes the results of these evaluations, which are described in detail below.
| Algorithm | Pseudocode Extraction | Time/Space Complexity | Executable Code Generation | Execution Fidelity | Data Encoding | Visualization Type | Aesthetics |
| Insertion Sort | 94.1% | 100% | 100% | 5 | 5 | 5 | 3.7 |
| Linked List | 94.7% | 100% | 100% | 5 | 4.6 | 5 | 2.9 |
| Binary Search Tree | 95.4% | 100% | 100% | 5 | 5 | 5 | 3.3 |
| Average | 94.7% | 100% | 100% | 5 | 4.87 | 5 | 3.28 |
Table 2. Evaluation results for three algorithms. LLM pipeline accuracy is reported as percentages, and AV quality is rated on a 5-point scale (1=poor, 5=excellent).
Accuracy Results. For pseudocode OCR detection, our pipeline achieved 94.1% for insertion sort, 95.4% for linked list traversal, and 94.7% for binary search tree search. For time and space complexity analysis and executable code generation, the system achieved 100% accuracy. Notably, the LLM correctly inferred complexity even when the same algorithm employed different processing strategies (e.g., recursion vs. loop iteration). These results demonstrate the robustness of the LLM’s inference capabilities, accurately inferring complexity and generating executable code even when OCR results were incomplete.
AV Quality Results. The quality evaluation revealed varying performances across different criteria. All algorithms achieved perfect scores (5.0) for Execution Fidelity, indicating that visualization command injection did not disrupt the generated code. Data Encoding scores were consistently high: insertion sort and binary search tree achieved 5.0, while linked list search scored 4.6. The lower score for linked-list search was attributed to a mismatch between the pseudocode implementation and visualization requirements, where the pseudocode contained only a partial linked list class implementation without essential initialization functions, which led to failure in creating the linked list. Visualization Type achieved perfect scores (5.0) across all algorithms. Aesthetics presented the lowest scores (insertion sort: 3.7, linked list: 2.9, binary search tree: 3.3). While the system successfully applied color coding to elements during active operations, visual feedback for completion states and traversal indicators sometimes failed to meet expectations and showed inconsistency within the same algorithm type. Specifically, color coding to indicate sorted completion or traversal history was sometimes not implemented as expected and exhibited substantial variation even among the same algorithm samples. Despite the rather underwhelming Aesthetics score in this evaluation, the follow up usability evaluations actually still found quite high overall usability, as discussed in the next section (see § 7 for further discussion).
Empirical Evaluations
Next, to evaluate the usability aspects and pedagogical implications of our system, we conducted a pair of user studies: (1) a usability study with 15 students, and (2) expert interviews with 6 university-level computer science educators. The usability study focused on assessing ease of use and feature preferences, while the expert interviews collected insights into the system’s educational potential from professional educators’ perspectives.
Usability Study
We evaluated the usability of our system via its tablet interface with pen-based interactions. To ensure comparability, identical pages from Introduction to Algorithms [13] were employed across all conditions. A total of 15 undergraduate and graduate computer science students (5 males, 10 females, ages 20–25 (m=22.2)) from Anonymized University participated in the study (see Appendix § 10 for demographics). All participants had previously completed an introductory DSA course. This was a crucial requirement, as we did not want participants to have to freshly learn the underlying concepts immediately prior to taking the study, and could thus focus on evaluating system usability aspects and feature preferences. Moreover, this also mimics a likely real-world use case for AUGMENTED ALGORITHM: participants would first be exposed to a DSA topic via “traditional” means (e.g., via textbook or lecture), and then would reinforce concepts via reviewing such content via AUGMENTED ALGORITHM. Study sessions were conducted in person and lasted approximately 35 minutes each.
Method: To ensure consistent conditions across all participants in the user study, we used pre-generated AVs whose correctness was verified (see § 7 for further discussion).
After obtaining user consent, participants were introduced to the system through a tutorial video and guided walk-through of its features. Once they had become familiar with the interface, they were asked to complete four tasks for each of three algorithms (i.e., insertion sort, linked list search, binary search tree search) to evaluate different functionalities of the system. At the beginning of each task, participants first read the pseudocode and surrounding explanation directly from the textbook, without using any interactive features. This served as the baseline condition, allowing participants to experience a “traditional” textbook-based learning process immediately before interacting with Augmented Algorithm. After completing this reading phase, participants used the tool’s interactive features to answer the following questions:
What are the worst-case time and space complexity?
When a specific element is found (or placed), which line of code is executed?
What is the value of a key variable (e.g., loop index or function argument) at that moment?
When the algorithm fails to find the target, which line is executed and what value is returned?
After completing all tasks, participants filled out a post-study questionnaire. The survey gathered feature-specific feedback and overall engagement and usefulness of the system. Feature-specific usefulness was evaluated with statements such as “Frame-by-frame animation was useful,” and overall engagement and usefulness with statements such as “I felt studying with the textbook with this system was useful,” both rated on a 7-point Likert scale (1=strongly disagree, 7=strongly agree). Additional open-ended questions elicited qualitative feedback. Finally, participants completed the System Usability Scale (SUS) [5] for the system.
Results: Augmented Algorithm received a high SUS score of 92.17 (SD=5.73), and participants felt they could use the system quickly and successfully (see Appendix § 11 for summary of SUS result).
Comparison of Textbooks and Augmented Algorithm: The results indicated substantial differences between the two conditions. Participants rated Augmented Algorithm significantly higher for engagement (M=6.67, SD=0.49) than simply reviewing the textbook directly (M=3.8, SD=1.26) and also for usefulness (M=6.8, SD=0.41) over textbooks (M=3.73, SD=1.28).
Qualitative feedback provided deeper insights into these quantitative differences. For engagement, participants consistently contrasted Augmented Algorithm with passive textbook reading. P11 mentioned that “seeing the live demo along with which part of the code is being executed made me feel very involved.” This highlights how real-time visualization and code alignment increased participants’ sense of involvement. Similarly, P3 noted that “interacting with different system components made me feel involved,” emphasizing the role of active manipulation in fostering engagement.
For usefulness, participants frequently emphasized how visualization clarified complex concepts. P3 remarked, “Being able to visualize the algorithm in different ways helped me process the information better than just reading the textbook.” Several participants also highlighted efficiency benefits. P9 noted, “It is faster to understand through the system compared to studying from the textbook, and visually I can remember things for a longer time.” These comments suggest that the system not only improved conceptual clarity but also reduced learning time and supported retention.
Comparison of the Different Features: Participants provided generally positive feedback for all features on a 7-point Likert scale (see Figure 8). The frame-by-frame animation received a high average rating (M=6.80, SD=0.41), with participants appreciating its support for visually tracking the algorithmic process. However, P4 noted, “When the animations are playing and the graphs are changing, it was sometimes hard to understand why that was happening.” The code-line highlighting feature was similarly rated (M=6.80, SD=0.56). Participants valued its ability to indicate the currently executed line of code. Several participants further emphasized that combining frame-by-frame animation with code-line highlighting facilitated comparison between the pseudocode and its visual representation. Most participants also found variable tracing helpful (M=6.73, SD=0.59). P6 and P14 mentioned that integrating code-line highlighting with variable tracing helped them understand each step of the pseudocode. P1 commented, “The variable tracing and code-line highlighting were especially useful since they made dry runs much easier.” However, P8 suggested, “It would be more convenient to keep this in a separate window and display all variable names with their corresponding values at each step, similar to a debugger.” The dynamic input feature was also positively received (M=6.67, SD=0.62), as it allowed participants to observe how the algorithm behaved with different inputs. Finally, participants appreciated the time/space complexity visualization (M=6.50, SD=0.83), which helped them understand algorithmic performance without closely examining the code. P6 remarked, “Having a complexity visualizer helped me understand how some functions are more efficient than others.” Nevertheless, P2 suggested that “there could be additional animations to explain time and space complexity.”
Figure 8. Usefulness ratings for various system features.
Expert Interviews
For our second empirical evaluation, we conducted semi-structured interviews with six instructors (E1–E6) to evaluate the system’s potential for educational applications. All participants had more than 10 years of teaching experience in university-level classes, with five instructors having specific DSA teaching experience (2-10+ years) and one instructor specializing in computer programming (10+ years). Each interview lasted approximately 40 minutes.
Method: We conducted semi-structured expert interviews through either on-site sessions or online sessions via Zoom. The purpose was to gather feedback on our system, assess its potential educational value, and identify areas for improvement. Each interview followed a common procedure while allowing participants to elaborate on topics based on their own teaching experience. First, we asked instructors to describe their current teaching practices, including the educational materials and tools they use, as well as challenges and pain points they encounter when teaching DSA or programming concepts. We then demonstrated the system and its main functionality. Following the demonstration, participants were given an opportunity to interact with the system themselves, using iPads for on-site sessions or personal computers for online sessions. As part of this hands-on exploration, participants generated algorithm visualizations (AVs) using examples drawn from the same dataset used in our technical evaluation.
After interacting with the system, we asked open-ended questions about their experience and its potential use in educational settings. The questions focused on five aspects: (1) educational value, (2) comparison with existing tools and resources, (3) classroom applicability, (4) support for students’ self-study and engagement, and (5) missing pedagogical features. Follow-up questions were asked based on participants’ responses to clarify their feedback or explore examples from their teaching practices in greater depth. We organized the resulting interview feedback based on recurring observations across participants and grouped it into the four themes reported below.
Results: Experts generally felt that our system could assist them in creating AVs for their students, and discussed a number of pedagogical implications. This feedback is summarized below, organized by key findings:
Reducing Instructor Workload and Improving Student Access: Instructors generally relied on lecture slides, blackboard demonstrations, or handwritten notes captured with document scanners to illustrate algorithmic steps. Most experts noted the time-consuming nature of searching for or creating animations independently. Although most were aware of existing online AV systems, they tended to avoid proactively integrating them into their classes. E2 mentioned that “I usually advise students not to use internet-available AVs because they often employ pseudocode or code that differs from what we use in lecture.” This highlights the difficulty of aligning external AVs with course-specific materials. Our system has the potential to reduce instructors’ workload by automatically generating animations that correspond directly to their own pseudocode and implementations. From a student perspective, this alignment also simplifies access to relevant learning resources. As E5 noted, “Unlike choosing from a long list of algorithms or watching hundreds of videos, students can directly select the content that is most relevant to their own learning needs.” To further support classroom integration, E4 suggested adding video export functionality, stating, “It would be helpful to export both the animations and highlighted pseudocode so I can include them directly in lectures.”
Encouraging In-Depth Self-Study: Experts identified several features that support independent learning. The clear correspondence between pseudocode and animation was viewed as especially helpful for beginners (E3, E4, E5, E6), as it clarifies abstract algorithmic steps. As E4 noted, “Seeing the pseudocode and the animation side by side really helps students understand each step, especially those who are new to algorithms.” Educators also appreciated the system’s ability to link pseudocode with executable code, supporting students’ implementation skills. Although the current system supports only a subset of DSA algorithms (see § 7), its potential to generate AVs from any pseudocode was highly valued, particularly for specialized or advanced algorithms not available on existing visualization websites (E3, E4). Additionally, the ability to animate incorrect code was seen as beneficial for experimental learning. E3 emphasized, “Being able to run incorrect code and immediately see the consequences through visualization encourages students to experiment and understand mistakes.”
Enhancing Student Engagement: Several experts noted that student disengagement remains a persistent challenge in DSA education and viewed our system as a promising tool for fostering interest among students who struggle with motivation. E1 observed that “interactive visualization can promote active learning and increase students’ interest,” while E3 added, “when I play the animation, they always pay attention to it.” This feedback highlights the system’s potential to shift learning from passive consumption of static materials to active engagement through interactive animation.
Need for Supplemental Explanations: Finally, several experts identified limitations related to explainability. Although the system relies on pseudocode to represent algorithmic processes at each step, pseudocode can be overly abstract for some learners (e.g., a classical algorithm such as Dijkstra’s shortest path has concise pseudocode but a complex implementation). As a result, students may struggle to interpret what the animations represent and why specific actions occur when relying solely on pseudocode. To address this issue, some experts recommended enhancements such as detailed explanatory text or audio annotations for each action (E4, E6), as well as features that highlight corresponding textbook sections explaining the current algorithmic steps (E3). These additions could help bridge the gap between visual representations and the underlying algorithmic concepts.
Discussion
Augmented Algorithm represents a novel tool that addresses salient challenges in AV by automatically generating LLM-powered visualizations from static pseudocode directly on curriculum learning materials. Based on our evaluations, the system achieves the design goals described in § 3: G1 by introducing an AV Code Generator that produces robust visualization code using multiple LLM agents with reflection mechanisms; G2 by displaying the AV panel directly on textbook content, with synchronized code-line highlighting and variable-tracing overlays; G3 by consolidating algorithm visualization, time/space complexity visualization, and code editing in a unified panel to “provide multiple views,” while offering intuitive animation controllers for “flexible execution control” and overlays that “complement visualizations with explanations”; G4 by supporting both Python and JavaScript within a scalable framework; and G5 by enabling dynamic input modification and code editing. Below, we further discuss and reflect on some of the lessons learned and outline opportunities for future research in this area, based on this work.
Towards Classroom Deployments: As represented by the design goals, the primary focus of this work was assessing and validating the UI/UX aspects of Augmented Algorithm, primarily via a controlled usability study and supplemental expert feedback from interviews. As mentioned in § 6.1, this usability focus was the reason that recruited student participants needed prior DSA exposure, which aligns with other examples of studies that first focus on the design of learning-focused tools (e.g., [8, 11, 22]). Given the success in these validations, in the future we intend to deploy Augmented Algorithm in classroom settings and conduct longitudinal studies of how the tool supports students, such as its impacts on learning outcomes, engagement, and knowledge retention across varying levels of prior experience.
Broadening Support for DSA Topics and Techniques: In this paper, we demonstrated that Augmented Algorithm effectively supports core algorithms and data structures commonly taught in university curricula. However, many DSA courses also cover more advanced topics, such as graph algorithms and red-black trees. Supporting these would require extending the visualization components and prompts for new algorithm types. Moreover, the current system supports only Python and JavaScript, limiting its use in courses that rely on other languages (e.g., C++, Java). As the system employs a modular design, both algorithm and language support can easily be extended without major architectural changes. Additionally, though the current system primarily targets introductory learners, adapting explanations and visual representations to different expertise levels (e.g., beginner, intermediate, advanced) could also broaden its applicability. Such adaptability could enable more personalized learning experiences and enhance the system’s pedagogical impact across diverse educational contexts.
Verifying LLM-Generated AV: Our technical evaluation confirmed that the system generates AV with high robustness. However, as with any LLM-driven tool, there is always the potential for off-target and/or hallucinated results; for instance, the Aesthetics sometimes fail to meet expectations. Such risks are widely acknowledged across the education and learning sciences communities [55].
Future work here will add mitigation features to reduce such possibilities: e.g., a reflection mechanism could assess visualization validity and consistency and trigger regeneration when issues are detected, and confidence scores could alert students to consult an instructor when confidence is low. Such features could help balance the risks of misinterpretation while maintaining usability for self-directed learning.
More Intuitive Visual Representations: Although the generated animations effectively demonstrate algorithmic processes, several experts suggested ways to make them more explanatory. For example, E5 remarked, ‘Adding visual effects for each loop, or clearly distinguishing between nested and outer loops, would make it easier for students to grasp the differences between algorithms.’ Additionally, E6 proposed incorporating well-known metaphors (e.g., bubble animations for bubble sort) to strengthen the connection between algorithm names, behaviors, and their visual representations. Such additions could more clearly emphasize structural elements and the current DSA concepts of interest, though this would increase the complexity and learning curve of the overall UI/UX, and would thus need to be carefully designed. One strategy here could be to support multiple levels of abstraction and explanation (e.g., a “minimal” visualization style vs. an embellished or heavily annotated style), similar to approaches supported by tools such as Chisel [26]. Recent LLM-based approaches for automatically generating stylized infographics [16, 56, 57] also suggest opportunities to create more expressive and personalizable visualizations.
More In-Depth Understanding: Although the user study revealed that our system is appropriately designed for facilitating learners in understanding DSA concepts, some experts (E3, E5, E6) expressed doubts about whether “simply visualizing algorithms” ensures true understanding, and they suggested ways to promote deeper learning and engagement. For example, they suggested incorporating interactive assessment features, such as pop quizzes, fill-in-the-blank exercises, and error correction tasks, after the learning phase. In part, we argue that Augmented Algorithm is positioned as a helper to existing curricula and learning materials, which hopefully already include these types of activities. That said, this recommendation also aligns with the best practice of “supporting dynamic questions” [40] such as periodically presenting short questions to encourage learners to reflect on a visualization. Such features could be integrated into Augmented Algorithm to encourage students to actively engage with a displayed algorithm beyond reviewing and animating it, promoting deeper comprehension through hands-on practice. Future work could, for example, explore implementing LLM-powered quiz generation modules to automatically create personalized assessments based on the extracted pseudocode.
Conclusion
Algorithm visualization tools are pedagogically effective for learning DSA. However, they remain underutilized for several reasons, such as the difficulty in integrating such tools into existing curricula and classroom practices. In this paper, we introduce Augmented Algorithm, an LLM-assisted tool that transforms static pseudocode into interactive algorithm visualizations to support hands-on interaction and learning. By orchestrating LLMs, our system automatically generates visualizations from textbook and other static content. A trio of evaluations, including a usability study with 15 student participants and expert interviews with 6 instructors, indicates that our approach can lower the barriers to creating and accessing DSA-focused visualizations, while supporting more engaging and personalized learning experiences. Looking ahead, extending the system to more complex algorithms and diverse learning environments offers promising directions for future work.
Prompts for AV Code Generator
In each prompt, certain variables are enclosed within curly brackets and colored blue for easy recognition.
Prompt for Pseudocode Analysis
The following variables are used in this prompt:
TIME_SPACE_COMPLEXITY_OPTIONS: Available options for time and space complexity analysis.state["pseudocode"]: Text extracted from the pseudocode image using OCR.
You are an expert in data structures and algorithms.
# Task
Analyze the algorithm name, input arguments, worst-case
time complexity, and space complexity from the pseudocode.
# Input
OCR result of pseudocode: {state["pseudocode"]}
# Output
Concise and structured output containing:
- Algorithm name
- Input arguments
- Worst-case Time complexity: Choose from
{TIME_SPACE_COMPLEXITY_OPTIONS}
- Space complexity: Choose from
{TIME_SPACE_COMPLEXITY_OPTIONS}
Prompts for Algorithm Code Generation
The following variables are used in this prompt:
state["programming_language"]: Programming language for implementation (Python or JavaScript).state["pseudocode"]: Text extracted from the pseudocode image using OCR.state["executable_algo_code"]: Generated executable algorithm code.state["algo_error_message"]: Execution or interpreter error message.
Algorithm Code Generation.
You are an expert in {state["programming_language"]} code
generation.
# Task
Generate clean, idiomatic, and **fully executable**
{state["programming_language"]} code from the pseudocode.
# Input
Pseudocode: {state["pseudocode"]}
# Output
Raw text of the translated code.
## Example:
# @line(0) BUBBLESORT(A)
def bubble_sort(A):
# @line(1) for i = 0 to A.length - 1
for i in range(len(A)):
if __name__ == "__main__":
bubble_sort([5, 3, 8, 4, 2])
Strict Formatting Rules:
- Output ONLY the raw code text; do NOT include markdown
blocks or explanations.
- Each pseudocode line that is translated must have an
@line(x) comment immediately before the corresponding
code, where `x` is the zero-based index of the line in the
original pseudocode (including comments and non-code lines).
- Include all function definitions and ensure the program
is complete (imports + main/test code).
- Maintain the logic of the original pseudocode exactly.
- Use clear and idiomatic {state["programming_language"]}
conventions.
- Include example usage such as `if __name__ == "__main__"`
or sample input/output.
Reflection.
You are an expert in {state["programming_language"]} code
generation.
# Task
Fix the executable algorithm code to make it run
successfully.
# Input
- Executable algorithm code: {state["executable_algo_code"]}
- Error message: {state["algo_error_message"]}
# Output
Raw text of the fixed algorithm executable code
## Strict Formatting Rules:
- Output ONLY the raw code text; do NOT include markdown
blocks or explanations.
Prompt for Visualization Type Selection
The following variables are used in this prompt:
VISUALIZATION_METHODS: Available visualization methods (1D Array, Bar Chart, Linked List, and Graph).state["pseudocode"]: Text extracted from the pseudocode image using OCR.state["executable_algo_code"]: Generated executable algorithm code.
You are an expert in algorithm visualization.
# Task
Analyze the pseudocode and executable algorithm code, and
select the most appropriate visualization method(s) from
the list provided. You must consider the characteristics of
the algorithm (e.g., data structure used, traversal style,
state changes) and the logic shown in the pseudocode.
# Input
- Pseudocode: {state["pseudocode"]}
- Executable algorithm code: {state["executable_algo_code"]}
# Output
Concise and structured output containing:
- Selected Visualization Method(s): List the most suitable visualization methods from {VISUALIZATION_METHODS} (you may choose multiple).
Prompts for Visualization Command Injection
The following variables are used in this prompt:
TEMPLATE_CODE["programming_language"]: Template for algorithm visualization in each programming language.
visualization_mapping_string: Mapping of visualization methods to class names.
vis_lib_cheat_sheet: Concise documentation for selected visualization methods.
state["programming_language"]: Programming language for implementation (Python or JavaScript).
state["executable_algo_code"]: Generated executable algorithm code.
state["executable_vis_code"]: Generated algorithm visualization code.
state["vis_error_message"]: Execution or interpreter error messages.
Visualization Command Injection
You are an expert in {state["programming_language"]} code generation.
# Task
Fill in the `<imports>` and `<stub>` sections of {TEMPLATE_CODE[state["programming_language"]]} and generate clean, idiomatic, and **fully executable** {state["programming_language"]} code to visualize interesting events of a given algorithm.
# Input
- Executable algorithm code: {state["executable_algo_code"]}
- Available visualization classes and methods:
{visualization_mapping_string}
- API cheat sheet: {vis_lib_cheat_sheet}
# Output
Raw text of the generated algorithm visualization code.
## Strict Formatting Rules:
- Output ONLY the raw code text; do NOT include markdown blocks or explanations.
- EVERY `@line` comment from the original algorithm code MUST be immediately followed by a structural `logger.println()` call, as detailed in Section 3. Traceability Logging.
- The main algorithm function must be called directly at the end of the script. DO NOT use an `if __name__ == '__main__':` block.
- Your final output must exactly match this structure,
- You MUST NOT alter the logic of the provided algorithm code in any way.
- Enclose all added code (visualization, highlighting, traceability logging, delay) within \textcolor{black}{`# {{` and `# }}` comments. This is mandatory for parsing.
## Implementation Guide:
### 1. Input Data Generation
- Input data MUST be dynamically created using the `Randomize` class. Do not use static examples.
- Using the generated input data, provide one most important scenario for the algorithm. This should be a single, meaningful input that showcases the algorithm's behavior effectively.
### 2. Visualization & Highlighting
- Drawing: Use the specified visualization classes and methods to render the data structures.
- Chart Sync: If using both `ChartTracer` and `Array1DTracer`, you MUST call `Array1DTracer.chart()` to sync them. Do not use `ChartTracer.set()` in this scenario.
- Highlighting States (Mutually Exclusive):
- `select`: Use when **comparing** elements.
- `patch`: Use **just before** an element's value is changed or swapped.
- `lock`: Use when an element becomes part of the **final, sorted partition** of the array.
- Logic for Applying `lock`:
- Identify the Sorted Partition: Most sorting algorithms work by progressively building a "sorted partition" (e.g., at the beginning or end of the array) and shrinking the "unsorted partition."
- Find the Newly Finalized Element: After each full pass of the algorithm's main outer loop (e.g., the `i` loop), your task is to identify which **one** new element has just been placed into its final, permanent position, thus expanding the sorted partition.
- Apply the Lock: Call the `lock()` method on the index of that single, newly finalized element. For example, after the first pass of the outer loop, one element will be sorted. After the second pass, a second element will be sorted, and so on.
- State Management: Before applying a new state (`select`, `patch`, `lock`), you MUST clear any pre-existing state from the element (e.g., call `deselect()` before `patch()`).
- Pausing: Call `Tracer.delay()` after each logical step to create a visual pause.
- Example (Swapping two elements):
When swapping `A[j]` and `A[j-1]`, you must call `patch` for **both** elements with their **new, future values** before the actual swap.
---
# @line(4) exchange A[j] with A[j - 1]
# {{
logger.println(f"@line(4) exchange A[{{j}}] @pos(from=A[j], to={{A[j]}}) with A[{{j - 1}}] @pos(from=A[j - 1], to={{A[j - 1]}})")
# }}
# 1. Announce the upcoming changes with patch()
array_tracer.patch(j, A[j - 1]); # Announce that A[j]
will become the value of A[j-1]
array_tracer.patch(j - 1, A[j]); # Announce that A[j-1]
will become the value of A[j]
Tracer.delay();
# 2. Perform the actual swap
const temp = A[j];
A[j] = A[j - 1];
A[j - 1] = temp;
# 3. Optional: Clear the patch highlight after the swap
is done
array_tracer.depatch(j);
array_tracer.depatch(j-1);
Reflection
You are an expert in {state["programming_language"]} code
generation.
# Task
Fix the algorithm visualization code to make it run
successfully.
# Input
- Algorithm visualization code:
{state["executable_vis_code"]}
- Error message: {state["vis_error_message"]}
# Output
Raw text of the fixed algorithm visualization code
## Strict Formatting Rules:
- Output ONLY the raw code text; do NOT include markdown
blocks or explanations.
Usability Study Participant Demographics
| ID | Age | Gender | Education | DSA Familiarity{sup}1` |
| P1 | 23 | Female | Postgraduate | 6 |
| P2 | 23 | Female | Postgraduate | 6 |
| P3 | 20 | Female | Bachelor | 5 |
| P4 | 22 | Female | Postgraduate | 6 |
| P5 | 22 | Male | Bachelor | 5 |
| P6 | 21 | Male | Bachelor | 5 |
| P7 | 23 | Female | Postgraduate | 5 |
| P8 | 25 | Female | Postgraduate | 7 |
| P9 | 25 | Male | Postgraduate | 6 |
| P10 | 21 | Female | Bachelor | 5 |
| P11 | 21 | Female | Bachelor | 5 |
| P12 | 23 | Female | Postgraduate | 4 |
| P13 | 21 | Male | Bachelor | 6 |
| P14 | 21 | Female | Bachelor | 5 |
| P15 | 22 | Male | Bachelor | 6 |
Table 3. Participant Demographics
Usability Study System Usability Score
Figure 9. Mean and standard deviation of participants’ answers to the SUS. Questions are divided into positive items (top half, higher is better) and negative items (bottom half, lower is better).
References
- [1]2018. Algorithm Visualizer. https://algorithm-visualizer.org/
- [2]Sriram Karthik Badam, Zhicheng Liu, and Niklas Elmqvist. 2019. Elastic Documents: Coupling Text and Tables through Contextual Visualizations for Enhanced Document Reading. IEEE Transactions on Visualization and Computer Graphics 25, 1 (Jan. 2019), 661–671. doi:10.1109/TVCG.2018.2865119DOI
- [3]Mordechai Ben-Ari, Niko Myller, Erkki Sutinen, and Jorma Tarhio. 2001. Perspectives on Program Animation with Jelot. In Revised Lectures on Software Visualization, International Seminar. Springer-Verlag, Berlin, Heidelberg, 31–45.
- [4]Michael Bostock, Vadim Ogievetsky, and Jeffrey Heer. 2011. D3: Data-Driven Documents. IEEE Transactions on Visualization and Computer Graphics 17, 12 (Dec. 2011), 2301–2309. doi:10.1109/TVCG.2011.185
- [5]John Brooke. 1995. SUS – a quick and dirty usability scale. https://www.researchgate.net/publication/319394819_SUS_-_a_quick_and_dirty_usability_scaleDOI
- [6]Marc H. Brown. 1988. Algorithm Animation. MIT Press, Cambridge, MA, USA.
- [7]Marc H. Brown and Robert Sedgewick. 1984. A system for algorithm animation. SIGGRAPH Comput. Graph. 18, 3 (Jan. 1984), 177–186. doi:10.1145/964965.808596DOI
- [8]S. Chawla, M. Kintscher, J. Narula, A. Arunkumar, A. Amresh, and C. Bryan. 2026. VizCoach: Designing an Orchestration-Based Tool for Data Visualization Education. In Proceedings of the 59th Hawaii International Conference on System Sciences (HICSS).
- [9]Xiang “Anthony” Chen, Chien-Sheng Wu, Lidiya Murakhovs’ka, Philippe Laban, Tong Niu, Wenhao Liu, and Caiming Xiong. 2023. Marvista: Exploring the Design of a Human-AI Collaborative News Reading Tool. ACM Trans. Comput.-Hum. Interact. 30, 6 (Sept. 2023), 921–927. doi:10.1145/3609331DOI
- [10]Ed H. Chi, Lichan Hong, Michelle Grumbrecht, and Stuart K. Card. 2005. Scen-thglights: highlighting conceptually-related sentences during reading. In Proceedings of the 10th international conference on Intelligent user interfaces (IUI ’05). Association for Computing Machinery, New York, NY, USA, 272–274. doi:10.1145/1040830.1040895
- [11]Neil Chulponsatorn, Mille Skovhus Lunding, Nishan Soni, and Ryo Suzuki. 2023. Augmented Math: Authoring AR-Based Explorable Explanations by Augmenting Static Math Textbooks. In Proceedings of the 36th Annual ACM Symposium on User Interface Software and Technology (UIST ’23). Association for Computing Machinery, New York, NY, USA, 1–16. doi:10.1145/3586183.3606827
- [12]Arturo I. Cormen, Nathan Leach, and Allan Knight. 2000. Algorithma 99: an experiment in reusability & component based software engineering. SIGCSE Bull. 32, 1 (March 2000), 162–166. doi:10.1145/331795.331847
- [13]Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. 2009. Introduction to Algorithms, Third Edition (3rd ed.). The MIT Press.
- [14]David Galles. 2011. CS 1332 Data Structures and Algorithms Visualizations. https://csvisualtool.com/
- [15]David Galles. 2011. Data Structure Visualization. https://www.cs.usfca.edu/~galles/visualization/about.html
- [16]Victor Dibia. 2023. LIDA: A Tool for Automatic Generation of Grammar-Agnostic Visualizations and Infographics using Large Language Models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations), Danushka Bollegala, Ruihong Huang, and Alan Ritter (Eds.). Association for Computational Linguistics, Toronto, Canada, 113–126. doi:10.18653/v1/2023.acl-demo.11DOI
- [17]Raymond Fok, Hita Kambhamettu, Luca Soldaini, Jonathan Bragg, Kyle Lo, Marti Hearst, Andrew Head, and Daniel S. Weld. 2023. Scim: Intelligent Skimming Support for Scientific Papers. In Proceedings of the 28th International Conference on Intelligent User Interfaces (IUI ’23). Association for Computing Machinery, New York, NY, USA, 476–490. doi:10.1145/3581641.3584034
- [18]Eric Fouh, Monika Akbar, and Clifford A. Shaffer. 2012. The Role of Visualization in Computer Science Education. Computers in the Schools 29, 1–2 (Jan. 2012), 95–117. doi:10.1080/07380569.2012.654122DOI
- [19]Sarthak Goel, Vanshika Varshney, Shubham Dikshant, Akhil Sharma, and Sherish Johri. 2023. A Review of The Algorithm Visualization Field. In 2023 14th International Conference on Computing Communication and Networking Technologies (ICCCNT). 1–5. doi:10.1109/ICCCNT56998.2023.10307685DOI
- [20]Scott Grissom, Myles F. McNally, and Tom Naps. 2003. Algorithm visualization in CS education: comparing levels of student engagement. In Proceedings of the 2003 ACM symposium on Software visualization (SoftVis ’03). Association for Computing Machinery, New York, NY, USA, 87–94. doi:10.1145/774306.774846
- [21]Aditya Gunturi, Yi Wen, Nandi Zhang, Jiarin Thundathil, Rubaiat Habib Kazi, and Ryo Suzuki. 2024. Augmented Physics: Creating Interactive and Embedded Physics Simulations from Static Textbook Diagrams. In Proceedings of the 37th Annual ACM Symposium on User Interface Software and Technology (UIST ’24). Association for Computing Machinery, New York, NY, USA, 1–12. doi:10.1145/3654777.3676392
- [22]Aditya Gunturi, Yi Wen, Nandi Zhang, Jiarin Thundathil, Rubaiat Habib Kazi, and Ryo Suzuki. 2024. Augmented Physics: Creating Interactive and Embedded Physics Simulations from Static Textbook Diagrams. In Proceedings of the 37th Annual ACM Symposium on User Interface Software and Technology (UIST ’24). Association for Computing Machinery, New York, NY, USA, 1–12. doi:10.1145/3654777.3676392
- [23]Philip J. Guo. 2013. Online python tutor: embedded web-based program visualization for cs education. In Proceedings of the 44th ACM technical symposium on Computer science education. ACM, Denver Colorado USA, 579–584. doi:10.1145/2445196.2445368DOI
- [24]Simin Hall, Clifford Shaffer, Eric Fouh, Mai ElShehaly, and Daniel Breakiron. 2013. Evaluating Online Tutorials for Data Structures and Algorithms Courses. In 2013 ASEE Annual Conference & Exposition Proceedings. ASEE Conferences, Atlanta, Georgia, 23.549.1–23.549.14. doi:10.18260/1-2--19563
- [25]Steven Hansen, N. Hari Narayan, and Mary Hegarty. 2002. Designing Educationally Effective Algorithm Visualizations. Journal of Visual Languages & Computing 13, 3 (June 2002), 291–317. doi:10.1006/jvlc.2002.0236
- [26]Devamardeep Haytapur, Brian Hempel, Richard Lin, and Haijun Xia. 2025. The Shapes of Abstraction in Data Structure Diagrams. In Proceedings of the 2025 CHI Conference on Human Factors in Computing Systems (CHI ’25). Association for Computing Machinery, New York, NY, USA, 1–12. doi:10.1145/3706598.3713723
- [27]Jessica Hullman, Nicholas Diakopoulos, and Eytan Adar. 2013. Contextifier: automatic generation of annotated stock visualizations. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI ’13). Association for Computing Machinery, New York, NY, USA, 2707–2716. doi:10.1145/2470654.2481374DOI
- [28]Christopher D. Hundhausen and Jonathan L. Brown. 2008. Designing, visualizing, and discussing algorithms within a CS 1 studio experience: An empirical study. Computers & Education 50, 1 (2008), 301–326. doi:10.1016/j.compedu.2006.06.002
- [29]Christopher D. Hundhausen, Sarah A. Douglas, and John T. Stasko. 2002. A Meta-Study of Algorithm Visualization Effectiveness. Journal of Visual Languages & Computing 13, 3 (June 2002), 259–290. doi:10.1006/jvlc.2002.0237DOI
- [30]Essi Isohanni and Hannu-Matti Järvinen. 2014. Are visualization tools used in programming education? by whom, how, and why not?. In Proceedings of the 14th Koli Calling International Conference on Computing Education Research (Koli Calling ’14). Association for Computing Machinery, New York, NY, USA, 35–40. doi:10.1145/2674683.2674688
- [31]Hyeonsu Kang, Joseph Chee Chang, Yongsung Kim, and Aniket Kittur. 2022. Threddy: An Interactive System for Personalized Thread-based Exploration and Organization of Scientific Literature. In Proceedings of the 35th Annual ACM Symposium on User Interface Software and Technology (UIST ’22). Association for Computing Machinery, New York, NY, USA, 1–15. doi:10.1145/3526113.3545660
- [32]Colleen Kehoe, John Stasko, and Ashley Taylor. 2001. Rethinking the evaluation of algorithm animations as learning aids: an observational study. International Journal of Human-Computer Studies 54, 2 (Feb. 2001), 265–284. doi:10.1006/ijhc.2000.0409DOI
- [33]Andreas Kerren and John T. Stasko. 2001. Algorithm Animation - Introduction. In Revised Lectures on Software Visualization, International Seminar. Springer-Verlag, Berlin, Heidelberg, 1–15.
- [34]Dae Hyun Kim, Enamul Hoque, Juho Kim, and Maneesh Agrawala. 2018. Facilitating Document Reading by Linking Text and Tables. In Proceedings of the 31st Annual ACM Symposium on User Interface Software and Technology (UIST ’18). Association for Computing Machinery, New York, NY, USA, 423–434. doi:10.1145/3242587.3242617DOI
- [35]Zhen Li, Michelle Annette, Ken Hinckley, Karan Singh, and Daniel Wigdor. 2019. HoloDoc: Enabling Mixed Reality Workspaces that Harness Physical and Digital Content. In Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems (CHI ’19). Association for Computing Machinery, New York, NY, USA, 1–14. doi:10.1145/3290605.3300917
- [36]Huifen Lin and Francis Dwyer. 2010. The effect of static and animated visualization: a perspective of instructional effectiveness and efficiency. Educational Technology Research and Development 58, 2 (2010), 155–174.
- [37]Damien Masson, Sylvain Maciarello, Géry Casiez, and Daniel Vogel. 2023. Chara-graph: Interactive Generation of Charts for Realtime Annotation of Data-Rich Paragraphs. In Proceedings of the 2023 CHI Conference on Human Factors in Computing Systems (CHI ’23). Association for Computing Machinery, New York, NY, USA, 1–18. doi:10.1145/3544548.3581091
- [38]Richard E. Mayer and Roxana Moreno. 1998. A split-attention effect in multimedia learning: Evidence for dual processing systems in working memory. Journal of Educational Psychology 90, 2 (1998), 312–320. doi:10.1037/0022-0663.90.2.312 Place: US.DOI
- [39]Jure Mornar, Andrína Granić, and Saša Mladenović. 2014. System for automatic generation of algorithm visualizations based on pseudocode interpretation. In Proceedings of the 2014 conference on Innovation & technology in computer science education (ITiCSE ’14). Association for Computing Machinery, New York, NY, USA, 27–32. doi:10.1145/2591708.2591743DOI
- [40]Thomas L. Naps, Guido Rößling, Vicki Almstrum, Wanda Dann, Rudolf Fleischer, Chris Hundhausen, Ari Korhonen, Lauri Malmi, Myles McNally, Susan Rodger, and J. Ángel Velázquez-Iturbide. 2002. Exploring the role of visualization and engagement in computer science education. SIGCSE Bull. 35, 2 (June 2002), 131–152. doi:10.1145/582929.782998
- [41]Maximiliano Paredes-Velasco, J. Ángel Velázquez-Iturbide, and Mónica Gómez-Ríos. 2023. Augmented reality with algorithm animation and their effect on students’ emotions. Multimedia Tools and Applications 82, 8 (March 2023), 11819–11845. doi:10.1007/s11042-022-13679-1. Company: Springer Distributor: Springer Institution: Springer Label: Springer Number: 8.
- [42]School of Computing, National University of Singapore and Steven Halim. 2015. VisuAlgo – Visualising Data Structures and Algorithms Through Animation. OLYMPIADS IN INFORMATICS 9 (July 2015), 243–245. doi:10.15388/ioi.2015.20
- [43]Dino Schweitzer, View Profile, Wayne Brown, and View Profile. 2007. Interactive visualization for the active learning classroom. ACM SIGCSE Bulletin 39, 1 (March 2007), 208–212. doi:10.1145/1227504.1227384DOI
- [44]Michael Sedlmair, Miriah Meyer, and Tamara Munzner. 2012. Design study methodology: Reflections from the trenches and the stacks. IEEE Transactions on Visualization and Computer Graphics 18, 12 (2012), 2431–2440.DOI
- [45]Clifford A. Shaffer, Monika Akbar, Alexander Joel D. Alon, Michael Stewart, and Stephen H. Edwards. 2011. Getting algorithm visualizations into the classroom. In Proceedings of the 42nd ACM technical symposium on Computer science education (SIGCSE ’11). Association for Computing Machinery, New York, NY, USA, 129–134. doi:10.1145/1953163.1953204DOI
- [46]Clifford A. Shaffer, Matthew L. Cooper, Alexander Joel D. Alon, Monika Akbar, Michael Stewart, Sean Ponce, and Stephen H. Edwards. 2010. Algorithm Visualization: The State of the Field. ACM Trans. Comput. Educ. 10, 3 (Aug. 2010), 9:1–9:22. doi:10.1145/1821996.1821997DOI
- [47]Zejiang Shen, Ruochen Zhang, Melissa Dell, Benjamin Charles Germain Lee, Jacob Carlson, and Weining Li. 2021. LayoutParser: A Unified Toolkit for Deep Learning Based Document Image Analysis. In Document Analysis and Recognition – ICDAR 2021: 16th International Conference, Lausanne, Switzerland, September 5–10, 2021, Proceedings, Part I. Springer-Verlag, Berlin, Heidelberg, 131–146. doi:10.1007/978-3-030-86549-8_9DOI
- [48]Yao Shi, Boiyan Li, Yuyu Luo, Lei Chen, and Nan Tang. 2025. Augmenting Realistic Charts with Virtual Overlays. In Proceedings of the 2025 CHI Conference on Human Factors in Computing Systems (CHI ’25). Association for Computing Machinery, New York, NY, USA, 1–23. doi:10.1145/3706598.3714320
- [49]John T. Stasko. 1997. Using student-built algorithm animations as learning aids. In Proceedings of the twenty-eighth SIGCSE technical symposium on Computer science education (SIGCSE ’97). Association for Computing Machinery, New York, NY, USA, 25–29. doi:10.1145/268084.268091DOI
- [50]Hariharan Subramanyam, Colleen Seifert, Priti Shah, and Eytan Adar. 2020. texSketch: Active Diagramming through Pen-and-Ink Annotations. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems (CHI ’20). Association for Computing Machinery, New York, NY, USA, 1–13. doi:10.1145/3313831.3376155
- [51]Yuan Tian, Weiwei Cui, Dazhen Deng, Xingji Yi, Yurun Yang, Haidong Zhang, and Yingcai Wu. 2025. ChartGPT: Leveraging LLMs to Generate Charts From Abstract Natural Language. IEEE Transactions on Visualization and Computer Graphics 31, 3 (March 2025), 1731–1745. doi:10.1109/TVCG.2024.3368621DOI
- [52]Tobias Nöthlich. 2020. AlgoVis.io - Online Algorithm Visualization. https://tobinator e.github.io/algovisi
- [53]Jaime Urquiza-Fuentes and J. Ángel Velázquez-Iturbide. 2009. A Survey of Successful Evaluations of Program Visualization and Algorithm Animation Systems. ACM Trans. Comput. Educ. 9, 2 (June 2009), 9:1–9:21. doi:10.1145/1538234.1538236
- [54]Priyan Vaithilingam, https://orcid.org/0000-0001-6730-5683, View Profile, Elena L. Glassman, https://orcid.org/0000-0001-5178-3496, View Profile, Jeevana Priya Inala, https://orcid.org/0000-0003-1843-589X, View Profile, Chenglong Wang, https://orcid.org/0000-0002-5933-6620, and View Profile. 2024. DynaVis: Dynamically Synthesized UI Widgets for Visualization Editing. Proceedings of the 2024 CHI Conference on Human Factors in Computing Systems (May 2024), 1–17. doi:10.1145/3613904.3624639arxiv.org/abs/2401.10880
- [55]Michael Van Wyk. 2024. Is ChatGPT an opportunity or a threat?: Preventive strategies employed by academics related to a GenAI-based LLM at a faculty of education. Journal of Applied Learning & Teaching 7, 1 (2024), 35–45.DOI
- [56]Shishi Xiao, Suizi Huang, Yue Lin, Yilin Ye, and Wei Zeng. 2024. Let the Chart Spark: Embedding Semantic Context into Chart with Text-to-Image Generative Model. IEEE Transactions on Visualization and Computer Graphics 30, 1 (Jan. 2024), 284–294. doi:10.1109/TVCG.2023.3326913DOI
- [57]Tongyu Zhou, Jeff Huang, and Gromit Yeuk-Yin Chan. 2024. Epigraphics: Message-Driven Infographics Authoring. In Proceedings of the 2024 CHI Conference on Human Factors in Computing Systems (CHI ’24). Association for Computing Machinery, New York, NY, USA, 1–18. doi:10.1145/3613904.3642172DOI
- [58]Slavomír Šimonák. 2020. Increasing the Engagement Level in Algorithms and Data Structures Course by Driving Algorithm Visualizations. Informatics 44, 3 (Sept. 2020). doi:10.31449/inf.v44i3.2864DOI
Machine contribution statement
No AI-use declaration is available for this version in Valency.
The available record does not establish whether AI systems or models contributed to this work.



