Standards for pseudo code?

pseudocode

I need to translate some python and java routines into pseudo code for my master thesis but have trouble coming up with a syntax/style that is:

  • consistent
  • easy to understand
  • not too verbose
  • not too close to natural language
  • not too close to some concrete programming language.

How do you write pseudo code? Are there any standard recommendations?

Best Answer

I recommend looking at the "Introduction to Algorithms" book (by Cormen, Leiserson and Rivest). I've always found its pseudo-code description of algorithms very clear and consistent.

An example:

DIJKSTRA(G, w, s)
1  INITIALIZE-SINGLE-SOURCE(G, s)
2  S ← Ø
3  Q ← V[G]
4  while Q ≠ Ø
5      do u ← EXTRACT-MIN(Q)
6         S ← S ∪{u}
7         for each vertex v ∈ Adj[u]
8             do RELAX(u, v, w)
Related Topic