▲ 14 r/datavisualization+2 crossposts

Recursion Visualized: a Quick_Sort Demo

Recursion can be hard to understand when you only look at the code.

Take quick_sort. Most explanations say:

  • “Pick a pivot, split the list, recursively sort the parts.”

That is correct, but it does not show what is really happening during execution. With package 𝗶𝗻𝘃𝗼𝗰𝗮𝘁𝗶𝗼𝗻_𝘁𝗿𝗲𝗲 you can step through the program and see the actual tree of function calls grow:

quick_sort(...)

  • → quick_sort(smaller_than_pivot)
  • → quick_sort(larger_than_pivot)
  • merge results from both sub problems
  • return merged result

This makes recursive algorithms much easier to reason about, especially for students who often struggle to build the right mental model for recursion.

See the live quick_sort demo.

The goal is simple: make recursion visible for easy understanding.

u/Sea-Ad7805 — 26 days ago
▲ 174 r/PythonBrasil+2 crossposts

Trie Data Structure Visualized

Ever wondered what a Trie actually looks like in memory?

A Trie is a tree of dictionaries, often used for problems like:

  • prefix search
  • word completion
  • spell checking
  • sequence matching

But when you implement one in Python, it can quickly become hard to “see” what is going on. That is where 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 helps.

It visualizes the actual Python objects: dictionaries, references, nested structure, and how the Trie grows step by step. Instead of only reading code, you can see the data structure being built in memory.

Run the Live Demo.

Visualizing data structures this way can make them much easier to understand and debug, especially for students learning Python.

See more 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 examples.

u/Sea-Ad7805 — 1 month ago
▲ 122 r/PythonProjects2+1 crossposts

Data Structures get easy with memory_graph Visualization

Understanding and debugging data structures becomes much easier when you can simply see the structure of your data with 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵.

Run this Linked List live demo.

A linked list is a nice teaching example because it makes references very explicit:

  • every node is a separate object
  • each node refers to the next and previous node
  • inserting or removing an element means changing references
  • a tiny mistake can disconnect part of the structure

Normally, students have to imagine all of this in their head. With 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵, they can inspect the actual Python objects and references directly. That makes it easier to understand:

  • aliasing
  • mutability
  • object identity
  • the call stack
  • sharing values by local variables in different functions

For beginners, this helps build the right mental model of Python data. For more advanced students, it helps debug pointer-like reference bugs in data structures.

u/Sea-Ad7805 — 2 months ago

Algorithms like Radix Sort are much easier to understand when you can see every intermediate step.

Using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵, you can watch how Radix Sort repeatedly applies stable Counting Sort, sorting the least significant digit up to the most significant digit in turn.

The key idea is stability: after sorting by a later digit, the order created by earlier digit-sorts is preserved resulting in a full sorted sequence.

For fixed-size integers, Radix Sort can be very efficient, with time complexity O(n · d), where 'n' is the number of values and 'd' is the number of digits.

reddit.com
u/Sea-Ad7805 — 2 months ago
▲ 27 r/PythonProjects2+1 crossposts

Algorithms like Radix Sort are much easier to understand when you can see every intermediate step.

Using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵, you can watch how Radix Sort repeatedly applies stable Counting Sort, sorting the least significant digit up to the most significant digit in turn.

The key idea is stability: after sorting by a later digit, the order created by earlier digit-sorts is preserved resulting in a fully sorted sequence.

For fixed-size integers, Radix Sort can be very efficient, with time complexity O(n · d), where 'n' is the number of values and 'd' is the number of digits.

u/Sea-Ad7805 — 2 months ago