Preview

pseudocode

Better Essays
Open Document
Open Document
2283 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
pseudocode
Pseudocode: A LATEX Style File for Displaying
Algorithms
D.L. Kreher
Department of Mathematical Sciences
Michigan Technological University
Houghton, MI 49931 kreher@mtu.edu and
D.R. Stinson
Department of Combinatorics and Optimization
University of Waterloo
Waterloo ON, N2L 3G1 dstinson@uwaterloo.ca 1

Introduction

This paper describes a LATEX environment named pseudocode that can be used for describing algorithms in pseudocode form. This is the style used in our textbook Combinatorial Algorithms: Generation, Enumeration and
Search [2]. The style file pseudocode.sty is available for free downloading from the web page http://www.math.mtu.edu/~kreher/cages.html
This package is quite easy to use, and allows algorithms to be described in a LATEX document using a natural Pascal-like syntax. In the remaining sections of this note, we describe how to use the pseudocode environment and we present some examples. Readers familiar with LATEX (see [3]) should be able to easily customize the style file to include additional desired features.
The pseudocode environment requires the fancybox package by Timothy Van Zandt. This package is described in Section 10.1.3 of [1]. Other environments for describing algorithms include alg, algorithmic, newalg and program. These style files, as well fancybox, are all available from the
CTAN web site http://www.ctan.org/

1

2

The pseudocode Environment

Within the pseudocode environment, a number of commands for popular algorithmic constructs are available. In general, the commands provided can be nested to describe quite complex algorithms.
The pseudocode environment is invoked as follows:
\begin{pseudocode}{<Name>}{<Parameters>}
pseudocode constructs
\end{pseudocode}
The argument <Name> is the name of the algorithm, and <Parameters> is a list of parameters for the algorithm. For example, the commands
\begin{pseudocode}{CelsiusToFahrenheit}{c}
f \GETS {9c/5} + 32\\
\RETURN{f}
\end{pseudocode} produce the following output when included



References: [1] M. Goossens, F. Mittelbach and A. Samarin, The LATEXCompanion, Addison-Wesley, 1994. [2] D.L. Kreher and D.R. Stinson, Combinatorial Algorithms: Generation, Enumeration and Search, CRC Press, 1999. [3] L. Lamport, LATEX, A Document Preparation System, Addison-Wesley, 1994. 14

You May Also Find These Documents Helpful

  • Satisfactory Essays

    ME2400 ICD9CM wk02 assign

    • 391 Words
    • 2 Pages

    Follow cross-reference instructions if the needed code is not located under the first main entry consulted.…

    • 391 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    IT210 Week 3

    • 756 Words
    • 4 Pages

    Side note; I had a very difficult time with this class in the first 3 weeks. However, I stumbled upon the Pseudocode Building Blocks tutorials on Youtube by Jack Lusby. They have helped me out tremendously.…

    • 756 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    It210 Week 4 Psuedocode

    • 584 Words
    • 3 Pages

    Program Pseudocode Currency_Convertor Main Module Delcare USDollars As Float Declare Rate1 As Float Declare Rate2 As Float Declare Rate3 As Float Declare Rate4…

    • 584 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    TCO #1– Given a simple business problem, design and desk-check a solution algorithm that is expressed in terms of pseudocode or program notes and input-process-output (IPO) analysis leading to a flow chart.…

    • 393 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Follow cross-reference instructions if the needed code is not located under the first main entry consulted.…

    • 441 Words
    • 2 Pages
    Good Essays
  • Better Essays

    Pow Write-Up 1

    • 1175 Words
    • 5 Pages

    In this POW write-up, I am trying to prove that there can be only one solution to this problem, and demonstrate and corroborate that all solutions work and are credible. What the problem of the week is asking is that the number that you put in the boxes 0-4 is the number of numbers in the whole 5-digit number. For example, if you put zero in the “one” box, you would be indicating that there is zero ones in the number. Another example is if you put a two in the “three” box. This would indicate that there are two threes in the whole 5-digit number. I was asked to find solutions where are the numbers would work in heir perspective boxes. From there I started working on the problem that would fit this criterion.…

    • 1175 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    UNIT 2

    • 470 Words
    • 3 Pages

    5.) Write the pseudocode for a program that will determine the average miles per gallon a car gets. (Inputs should be miles driven and gallons of gas used)…

    • 470 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    Breaking Code

    • 3562 Words
    • 15 Pages

    Only six months after Japan attacked Pear Harbor, another battle took place in Midway. It was the Battle of Midway that involved the United States and Japan. Many people thought it was the turning point in World War II.…

    • 3562 Words
    • 15 Pages
    Better Essays
  • Better Essays

    Medical Coding Final Exam

    • 1065 Words
    • 5 Pages

    1. The main difference between coding outpatient and inpatient is the procedure codes. Current Procedural Terminology (CPT) codes are used for outpatient coding and the International Classification of Diseases Ninth Revision Clinical Modification (ICD-9-CM) is used for inpatient coding. CPT codes are published by the American Medical Association and The World Health Organization (WHO) is responsible for ICD codes. The ICD-9 diagnoses codes are used for both outpatient and inpatient coding.…

    • 1065 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    Hammurabis Code

    • 849 Words
    • 2 Pages

    Imagine a society without rules and regulations. Everyone can do exactly what they want and there is no difference between what is right and wrong. This is the world that the people of Babylon lived in before King Hammurabi took reign. Hammurabi ruled the city-state of Babylon in the early 1800’s BCE, during the 38th year of his rule, Hammurabi created a set of laws supposedly given to him directly from the god of justice himself, Shamash. According to Document A, the 282 laws, promoting justice to the weak, were carved into large pillar shaped stones called stele. They later became known as Hammurabi’s Code. Today we are going to analyze these laws in order to determine whether or not they were fair to the victim, the accused, and society. Personally I believe that these laws were indeed fair in his ancient era , although we don’t know much about life in this century, by studying these laws we can find out.…

    • 849 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    If you like working in an office setting and are drawn to the health field, then you may want to pursue a career in medical coding. Medical coders don't have direct patient contact, but they work with patient charts and medical histories. Coding is interesting work that is in demand since medical records are primarily digital today. Here's a look at this occupation and how you train for it.…

    • 456 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Code Violation

    • 5090 Words
    • 21 Pages

    6) Provision for empowering engineers and architects for sanctioning plans of residential buildings up to 500 m2…

    • 5090 Words
    • 21 Pages
    Powerful Essays
  • Satisfactory Essays

    Php Codes

    • 3482 Words
    • 14 Pages

    This article is about the line of tablet computers designed and marketed by Apple Inc. For specific later models and other uses, see iPad (disambiguation).…

    • 3482 Words
    • 14 Pages
    Satisfactory Essays
  • Good Essays

    Some Qustions

    • 295 Words
    • 2 Pages

    2. Type the source code below into a text editor such as Notepad + +, Edit + +, JCreators,…

    • 295 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Anacor Algorithm

    • 1200 Words
    • 5 Pages

    The ANACOR algorithm consists of three major parts: 1. 2. 3. A singular value decomposition (SVD) Centering and rescaling of the data and various rescalings of the results Variance estimation by the delta method.…

    • 1200 Words
    • 5 Pages
    Powerful Essays