DSA in 3D
A pure Java 3D visualizer for arrays, linked lists, stacks, queues, trees, heaps, and graphs — including a ray tracer, camera moves, and a builder API inspired by the collections framework.
Stack Java · Ray tracing · FFmpeg · No dependencies
Data structure visualizers usually fall into one of two categories: a web animation that looks good and teaches very little, or a debugger view that teaches a lot and looks like a debugger. DSA in 3D is an attempt to make the object itself the explanation: an array becomes a row of boxes, an AVL tree becomes a set of rotating branches, a graph becomes a space you can move through.
It is written in pure Java with no Maven, no Gradle, and no external dependencies. The renderer, the data structures, the animation system, and the video export are all in the repository. Clone it, open it in IntelliJ, run it.
The library
The core is a small set of generic structures with a builder-style API: JLinkedList, JArrayList, JStack, JQueue, JAVLTree, JHeap, and JGraph. Each one exposes the operations you would expect, and each operation can be rendered. The visualizer is not a separate mode bolted on at the end; the structure and its animation share the same contract.
The rendering layer started as a minimal ray tracer. Boxes have geometry, materials, and a camera. The early versions were a single shape on a black field. The later ones support camera paths, subtitles, generated video, and a live mode that renders to the screen while the operation runs.
The hard parts
The camera. A visualization is only useful if the viewer can see the thing that changed. The camera path is computed from the operation, not chosen by hand: when a node is inserted, the camera moves to the insertion point and then pulls back to show the new shape.
The video pipeline. Exporting frames with FFmpeg exposed a dozen edge cases: odd resolutions, missing audio streams, interrupted writes, and frame timing drift. The fix was a small encoder abstraction with a single responsibility, plus a lot of tests that run on generated frames.
The API. The structures had to feel like Java collections, not like a rendering framework. The .with() methods configure the visualizer; the collection methods do the work. A student should be able to read the code and recognise the data structure underneath.
TIP
The best complement to a visualization is a pause. The live mode lets the viewer step through an operation, not just watch it.
What I would keep
The subtitle track. It is generated from the same events as the animation, so the words and the picture cannot drift apart. It turns a demo into a lesson without adding a narrator.