<< All versions

Skill v1.0.0

currentLLM-judged scan90/100
danielpohlmann/ia-marktplace/dev-algorithms-data-structures
──Details
PublishedOctober 23, 2026 at 09:30 PM
Content Hashsha256:2f35939498463b91...
Git SHAaff862584ad3
──Files
Files (1 file, 3.9 KB)
SKILL.md3.9 KBactive
SKILL.md · 83 lines · 3.9 KB

version: "1.0.0" name: dev-algorithms-data-structures description: Use when choosing, implementing, or comparing data structures by access pattern. USE FOR: arrays, linked lists, stacks, queues, hash tables, BST/AVL/Red-Black/B-Tree/Trie, heaps, graph representations, operation complexities. DO NOT USE FOR: algorithms on graphs (use dev-algorithms-graph-algorithms), sort/search selection (use dev-algorithms-sorting-searching).


Data Structures

Overview

Data structures are the foundation of efficient software. The choice of data structure determines the complexity of every operation your program performs. Knuth's The Art of Computer Programming, Volume 1: Fundamental Algorithms provides the definitive treatment of information structures -- from linear lists through trees and multilinked structures. This skill covers the major data structures, their operation complexities, and guidance on when to use each.

Arrays

A contiguous block of memory storing elements of the same type, accessed by index.

OperationTime
Access by indexO(1)
Search (unsorted)O(n)
Search (sorted)O(log n)
Insert at endO(1) amortized (dynamic array)
Insert at positionO(n)
Delete at positionO(n)

Use when: Random access is frequent, data size is known or grows by appending, cache locality matters.

Stacks

Last-In, First-Out (LIFO) structure.

OperationTime
PushO(1)
PopO(1)
Peek/TopO(1)
SearchO(n)

Implementations: Array-based (dynamic array) or linked-list-based.

Use when: Undo operations, expression evaluation/parsing, DFS traversal, call stack simulation, balanced parentheses checking.

Choosing the Right Data Structure

NeedData StructureWhy
Fast index-based accessArrayO(1) random access
Fast insertions/deletions anywhereLinked ListO(1) with pointer
LIFO behaviorStackPush/pop O(1)
FIFO behaviorQueueEnqueue/dequeue O(1)
Fast key-value lookupHash TableO(1) average
Ordered key-value storageBST / Red-Black TreeO(log n) with ordering
Fast lookup with frequent readsAVL TreeStrict balance
Fast lookup with frequent writesRed-Black TreeFewer rotations
Disk-based storage / databasesB-TreeMinimizes I/O
String prefix operationsTrieO(m) prefix search
Priority-based processingHeap / Priority QueueO(log n) extract-min/max
Modeling relationshipsGraph (adjacency list)Flexible structure

Best Practices

  • Choose the data structure based on the dominant operation pattern: read-heavy, write-heavy, or balanced.
  • Prefer standard library implementations -- they are well-tested and optimized for real-world usage.
  • Consider cache locality: arrays and array-backed structures (heaps, hash tables with open addressing) are more cache-friendly than pointer-based structures.
  • For concurrent access, consider concurrent variants (ConcurrentHashMap, lock-free queues).
  • Remember that theoretical complexity is not the full story -- constant factors, memory allocation patterns, and cache behavior matter in practice.
  • Reference Knuth's TAOCP Vol. 1, Chapter 2 (Information Structures) for rigorous treatment of linked structures, trees, and multilinked representations.

Detailed reference

Load only the file that matches the task — each is self-contained.

FileContents
references/trees.mdTrees — Binary Search Tree (BST), AVL Tree, Red-Black Tree, B-Tree, Trie (Prefix Tree)
references/details.mdLinked Lists; Queues; Hash Tables; Heaps; Graphs

References

See references/rules.md for the full rule catalog.

All versions