伪代码的标准? [英] Standards for pseudo code?
本文介绍了伪代码的标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一些 python 和 java 例程翻译成我的硕士论文的伪代码,但在想出以下语法/样式时遇到了麻烦:
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:
- 一致
- 易于理解
- 不要太冗长
- 不太接近自然语言
- 不太接近某些具体的编程语言.
你是怎么写伪代码的?是否有任何标准建议?
How do you write pseudo code? Are there any standard recommendations?
推荐答案
我建议您阅读算法导论"一书(由 Cormen、Leiserson 和 Rivest 撰写).我一直觉得它对算法的伪代码描述非常清晰和一致.
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.
示例:
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)
这篇关于伪代码的标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文