Playground

Pseudocode Playground

Write or paste any algorithm in Forge Pseudocode — your own, or one from the lessons — give it inputs and run it. Then watch it execute line by line, or measure how its work grows as the input gets bigger.

Quick reference

The language

Levitin-style pseudocode; blocks are set by indentation (4 spaces).

  • Assign with ← (or <-); = means “is equal to”.
  • for i ← 0 to n - 1 do, downto, for each x in S do, while … do, repeat … until …
  • if … then … else if … else, and or not, div mod ⌊x⌋ ⌈x⌉
  • swap A[i] and A[j], return, print x, y
  • A header A[0..n-1] binds n; A[l..r] binds l and r.

Built-ins

  • length(A) array(n, fill) matrix(r, c, fill) append(L, x)
  • min max abs sqrt floor ceil log2
  • Stacks and queues: push pop top enqueue dequeue isEmpty
  • Priority queues: Q ← priorityQueue(), insert(Q, item, key), deleteMin(Q)
  • Maps and sets: map() set() contains get(M, k, default)
  • ∞, true / false, null

Inputs and links

  • Numbers 42, lists [3, 1, 2], text "abc" (quotes optional for a single word), nested lists for graphs and matrices [[1, 2], [0], []], ∞, null.
  • The 🎲 button next to an input makes random arrays, text and graphs of any size.
  • Copy link packs your code and inputs into the address itself — nothing is uploaded.
  • Your work is kept as a draft in this browser. Download .txt saves a copy.

New to the dialect? Start with Lesson 0 · Start here, then practise with graded problems in the Arena.