Before editing or making new articles please read this.

When making a new article about an Algorithm or a Data Structure, please try to put the pseudo code/implementation of it on the article. If you add the implementation in one or more languages, please get the syntax right. When you edit articles, do not add more information than needed and refrain from wordiness.

Pseudocode conventions

  • Indentation indicates block structure. Saves space and writing time.
  • Looping constructs are like in C, C++, Pascal, and Java. We assume that the loop variable in a for loop is still defined when the loop exits (unlike in Pascal).
  • // indicates that the remainder of the line is a comment.
  • Variables are local, unless otherwise specified.
  • We often use objects, which have attributes (equivalently, fields). For an attribute attr of object x, we write attr[x]. (This would be the equivalent of x.attr in Java or x->attr in C++.)
  • Objects are treated as references, like in Java. If x and y denote objects, then the assignments y <- x make x and y point to the same object. It does not cause attributes of one object to be copied to another.
  • Parameters are passed by value, as in Java and C (and the default mechanism in Pascal and C++). When an object is passed by value, it is actually a reference (or pointer) that is passed; changes to the reference itself are not seen by the caller, but changes to the objects attributes are.
  • The boolean operators 'and' and 'or' are short-circuiting: if after evaluating the left-hand operand, we know the result of the expression, then we don't evaluate the right-hand operand. (If x is FALSE in 'x and y' then we don't evaluate y. If x is TRUE in 'x or y' then we don't evaluate y.) 

Please follow these conventions while writing pseudo code for this wiki.

Thank you for taking the time to read this and thank you for think about contributing! Have a good day.

For more information see the rules page.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.