Claude
Skills
Sign in
Back

data-structures

Included with Lifetime
$97 forever

Computer science data structure visualization in draw.io — arrays, linked lists, trees, graphs, hash tables, heaps, stacks, queues

General

What this skill does


# Data Structure Diagrams

## Quick Reference

| Structure | Best For | Complexity |
|-----------|----------|------------|
| Array | Sequential data, index access | Low |
| Linked List | Insertion/deletion demos | Low |
| Stack | LIFO operations, call stacks | Low |
| Queue | FIFO operations, BFS | Low |
| Binary Tree | Hierarchical data, BST | Medium |
| AVL / Red-Black Tree | Balanced search demos | Medium |
| B-Tree | Database index visualization | High |
| Heap | Priority queue, heapsort | Medium |
| Hash Table | Key-value mapping, collisions | Medium |
| Graph | Networks, relationships, paths | Medium-High |
| Trie | Prefix search, autocomplete | Medium |

---

## Shared Style Constants

```
Cell colors:
  Default:    fillColor=#DAE8FC;strokeColor=#6C8EBF;  (blue)
  Highlight:  fillColor=#D5E8D4;strokeColor=#82B366;  (green — active/found)
  Alert:      fillColor=#F8CECC;strokeColor=#B85450;  (red — removed/error)
  Visited:    fillColor=#FFF2CC;strokeColor=#D6B656;  (yellow — traversed)
  Empty:      fillColor=#F5F5F5;strokeColor=#CCCCCC;  (gray — null/empty)

Text:  fontColor=#333333;fontSize=14;fontFamily=Consolas;
Index: fontColor=#999999;fontSize=10;fontStyle=2;  (italic, small)
Arrow: strokeColor=#666666;strokeWidth=2;endArrow=block;endFill=1;
```

---

## Arrays

### Linear Array

```xml
<mxGraphModel>
  <root>
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
    <!-- Index labels -->
    <mxCell id="idx0" value="0" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#999999;fontSize=10;fontStyle=2;align=center;" vertex="1" parent="1">
      <mxGeometry x="40" y="20" width="60" height="20" as="geometry"/>
    </mxCell>
    <mxCell id="idx1" value="1" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#999999;fontSize=10;fontStyle=2;align=center;" vertex="1" parent="1">
      <mxGeometry x="100" y="20" width="60" height="20" as="geometry"/>
    </mxCell>
    <mxCell id="idx2" value="2" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#999999;fontSize=10;fontStyle=2;align=center;" vertex="1" parent="1">
      <mxGeometry x="160" y="20" width="60" height="20" as="geometry"/>
    </mxCell>
    <mxCell id="idx3" value="3" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#999999;fontSize=10;fontStyle=2;align=center;" vertex="1" parent="1">
      <mxGeometry x="220" y="20" width="60" height="20" as="geometry"/>
    </mxCell>
    <mxCell id="idx4" value="4" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#999999;fontSize=10;fontStyle=2;align=center;" vertex="1" parent="1">
      <mxGeometry x="280" y="20" width="60" height="20" as="geometry"/>
    </mxCell>
    <!-- Array cells -->
    <mxCell id="a0" value="42" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontColor=#333333;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="40" y="40" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="a1" value="17" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontColor=#333333;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="100" y="40" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="a2" value="93" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#D5E8D4;strokeColor=#82B366;fontColor=#333333;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="160" y="40" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="a3" value="8" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontColor=#333333;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="220" y="40" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="a4" value="51" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontColor=#333333;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="280" y="40" width="60" height="40" as="geometry"/>
    </mxCell>
    <!-- Pointer arrow -->
    <mxCell id="ptr" value="current" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#B85450;fontSize=11;fontStyle=1;align=center;" vertex="1" parent="1">
      <mxGeometry x="160" y="90" width="60" height="20" as="geometry"/>
    </mxCell>
  </root>
</mxGraphModel>
```

### 2D Matrix

Use a grid of cells. Each row shares the same Y, each column the same X. Add row/column headers with index labels.

```xml
<!-- Row 0 -->
<mxCell id="m00" value="1" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=13;fontFamily=Consolas;" vertex="1" parent="1">
  <mxGeometry x="80" y="40" width="50" height="40" as="geometry"/>
</mxCell>
<mxCell id="m01" value="2" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=13;fontFamily=Consolas;" vertex="1" parent="1">
  <mxGeometry x="130" y="40" width="50" height="40" as="geometry"/>
</mxCell>
<mxCell id="m02" value="3" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=13;fontFamily=Consolas;" vertex="1" parent="1">
  <mxGeometry x="180" y="40" width="50" height="40" as="geometry"/>
</mxCell>
<!-- Row 1 -->
<mxCell id="m10" value="4" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=13;fontFamily=Consolas;" vertex="1" parent="1">
  <mxGeometry x="80" y="80" width="50" height="40" as="geometry"/>
</mxCell>
```

---

## Linked Lists

### Singly Linked List

Each node has a data cell and a pointer cell side by side:

```xml
<mxGraphModel>
  <root>
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
    <!-- Node 1 -->
    <mxCell id="n1data" value="10" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="40" y="60" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="n1ptr" value="&#x2022;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=18;" vertex="1" parent="1">
      <mxGeometry x="100" y="60" width="30" height="40" as="geometry"/>
    </mxCell>
    <!-- Node 2 -->
    <mxCell id="n2data" value="20" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="200" y="60" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="n2ptr" value="&#x2022;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=18;" vertex="1" parent="1">
      <mxGeometry x="260" y="60" width="30" height="40" as="geometry"/>
    </mxCell>
    <!-- Node 3 (tail) -->
    <mxCell id="n3data" value="30" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=14;fontFamily=Consolas;" vertex="1" parent="1">
      <mxGeometry x="360" y="60" width="60" height="40" as="geometry"/>
    </mxCell>
    <mxCell id="n3ptr" value="&#x2205;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#F5F5F5;strokeColor=#CCCCCC;fontSize=14;" vertex="1" parent="1">
      <mxGeometry x="420" y="60" width="30" height="40" as="geometry"/>
    </mxCell>
    <!-- Arrows -->
    <mxCell id="e12" style="edgeStyle=entityRelationEdgeStyle;strokeColor=#666666;strokeWidth=2;endArrow=block;endFill=1;" edge="1" source="n1ptr" target="n2data" parent="1">
      <mxGeometry relative="1" as="geometry"/>
    </mxCell>
    <mxCell id="e23" style="edgeStyle=entityRelationEdgeStyle;strokeColor=#666666;strokeWidth=2;endArrow=block;endFill=1;" edge="1" source="n2ptr" target="n3data" parent="1">
      <mxGeometry relative="1" as="geometry"/>
    </mxCell>
    <!-- Head label -->
    <mxCell id="head" value="head" style="text;html=1;fillColor=none;strokeColor=none;fontColor=#B85450;fontSize=11;fontStyle=1;align=center;" vertex="1" parent="1">
      <mxGeometry x="40" y="36" width="60" height="20" as="geometry"/>
    </mxCell>
 

Related in General