The algorithmicx package provides functionality for customizing the layout of algorithms typeset in LaTeX. It includes predefined layouts mimicking pseudocode, Pascal, and C styles that can be used or modified. The package also allows users to define completely new algorithmic structures and layouts as needed. It provides macros for typesetting common elements like loops and conditionals as well as tools for customizing formatting, labeling, and breaking algorithms across multiple pages.
This document provides lecture notes for a C++ course. It notes that the document is a work in progress and needs polishing. It describes the tools used for the course, including GNU/Linux, GNU C++ compiler, emacs text editor, and UNIX commands. It also provides information on copyright and allows for free redistribution of the document without modification. The document then outlines the various chapters that will be covered in the course, including memory and CPU concepts, shell and C++ basics, expressions and functions, arrays and pointers, debugging, algorithms and sorting.
This document is the user manual for XORP version 1.8-CT. It describes how to configure and operate a router running the XORP software. The manual contains information on XORP command structure and modes, how to configure network interfaces, firewall rules, routing protocols and other aspects of the XORP router. It is covered by an open source license and the community is encouraged to provide feedback and contributions to improve the manual.
We introduce computational network (CN), a unified framework for describing arbitrary learning machines, such as deep neural networks (DNNs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), long short term memory (LSTM), logistic regression, and maximum entropy model, that can be illustrated as a series of computational steps. A CN is a directed graph in which each leaf node represents an input value or a parameter and each non-leaf node represents a matrix operation upon its children. We describe algorithms to carry out forward computation and gradient calculation in CN and introduce most popular computation node types used in a typical CN.
We further introduce the computational network toolkit (CNTK), an implementation of CN that supports both GPU and CPU. We describe the architecture and the key components of the CNTK, the command line options to use CNTK, and the network definition and model editing language, and provide sample setups for acoustic model, language model, and spoken language understanding. We also describe the Argon speech recognition decoder as an example to integrate with CNTK.
Assembly Codes in C Programmes - A Short Notes by Arun Umraossuserd6b1fd
Notes for integration of Assembly language into C programming language. Suitable for novice programmer in C for embedded systems or emulators or simulators.
Perl <b>5 Tutorial</b>, First Editiontutorialsruby
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
This document is a user's guide for version 1.21 of the cvx modeling tool for convex optimization problems. Cvx allows users to specify convex problems in a simple way and solves them using solvers like SeDuMi and SDPT3. The guide explains what cvx is, how to get started using it, the rules it follows to ensure problems are convex, and how to model different types of convex problems. It also covers advanced topics like semidefinite and geometric programming.
This document provides a crash course introduction to the Perl programming language. It discusses running Perl scripts, basic syntax including variables and data types, and some key concepts. It aims to give readers enough knowledge to write simple Perl programs and be aware of more advanced topics to explore further if desired.
This document provides lecture notes for a C++ course. It notes that the document is a work in progress and needs polishing. It describes the tools used for the course, including GNU/Linux, GNU C++ compiler, emacs text editor, and UNIX commands. It also provides information on copyright and allows for free redistribution of the document without modification. The document then outlines the various chapters that will be covered in the course, including memory and CPU concepts, shell and C++ basics, expressions and functions, arrays and pointers, debugging, algorithms and sorting.
This document is the user manual for XORP version 1.8-CT. It describes how to configure and operate a router running the XORP software. The manual contains information on XORP command structure and modes, how to configure network interfaces, firewall rules, routing protocols and other aspects of the XORP router. It is covered by an open source license and the community is encouraged to provide feedback and contributions to improve the manual.
We introduce computational network (CN), a unified framework for describing arbitrary learning machines, such as deep neural networks (DNNs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), long short term memory (LSTM), logistic regression, and maximum entropy model, that can be illustrated as a series of computational steps. A CN is a directed graph in which each leaf node represents an input value or a parameter and each non-leaf node represents a matrix operation upon its children. We describe algorithms to carry out forward computation and gradient calculation in CN and introduce most popular computation node types used in a typical CN.
We further introduce the computational network toolkit (CNTK), an implementation of CN that supports both GPU and CPU. We describe the architecture and the key components of the CNTK, the command line options to use CNTK, and the network definition and model editing language, and provide sample setups for acoustic model, language model, and spoken language understanding. We also describe the Argon speech recognition decoder as an example to integrate with CNTK.
Assembly Codes in C Programmes - A Short Notes by Arun Umraossuserd6b1fd
Notes for integration of Assembly language into C programming language. Suitable for novice programmer in C for embedded systems or emulators or simulators.
Perl <b>5 Tutorial</b>, First Editiontutorialsruby
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
This document is a user's guide for version 1.21 of the cvx modeling tool for convex optimization problems. Cvx allows users to specify convex problems in a simple way and solves them using solvers like SeDuMi and SDPT3. The guide explains what cvx is, how to get started using it, the rules it follows to ensure problems are convex, and how to model different types of convex problems. It also covers advanced topics like semidefinite and geometric programming.
This document provides a crash course introduction to the Perl programming language. It discusses running Perl scripts, basic syntax including variables and data types, and some key concepts. It aims to give readers enough knowledge to write simple Perl programs and be aware of more advanced topics to explore further if desired.
This user manual provides instructions for using Scrivener 2.1 software. It includes sections on installation and interface overview, project management, outlining and organizing documents, writing and editing tools, compiling drafts into final formats like PDF and HTML, and customizing preferences. The manual contains over 400 pages with detailed explanations and screenshots to help users maximize the power of Scrivener for drafting, organizing, and compiling a variety of creative works and documents.
Notes of 8085 micro processor Programming for BCA, MCA, MSC (CS), MSC (IT) &...ssuserd6b1fd
If you are beginners in 8085 micro processor and wants to be a professional in 8085 micro processor programming then read this notes. It surely helped you in understanding of 8085 micro processor from bottom to top.
This document provides an advanced guide for developing macros in IBM Rational Host Access Transformation Services (HATS). It covers macro structure, data types, operators, expressions, how the macro runtime processes macros, screen description and recognition, and available macro actions. The guide contains definitions of terms and includes conceptual diagrams and code samples to illustrate macro concepts and functionality. It is intended to help macro developers better understand and utilize the full capabilities of the HATS macro language.
This document provides an advanced guide for developing macros in IBM Rational Host Access Transformation Services (HATS). It covers macro structure, data types, operators, expressions, how the macro runtime processes macros, screen description and recognition, and available macro actions. The guide contains definitions of terms and includes conceptual diagrams and code samples to illustrate macro design and processing. It is intended to help macro developers better understand and utilize the full capabilities of the HATS macro language.
This document provides a summary of Linux advanced routing and traffic control techniques. It covers topics like routing with iproute2, policy routing, GRE and other tunneling methods, IPv6 tunneling, IPsec, multicast routing, traffic shaping with different queueing disciplines, load balancing across interfaces, packet marking with Netfilter, advanced packet filtering, kernel network parameters, and other advanced queueing disciplines. The goal is to provide hands-on guidance for configuring and managing routing, traffic control, and related Linux networking functions.
This document provides a user manual for gstat, a program for geostatistical modeling, prediction, and simulation of spatial data in one, two or three dimensions. Gstat allows for variogram modeling, kriging (prediction), and simulation using a variety of methods. It supports many data formats and provides a flexible command language for controlling geostatistical analyses. The manual describes the capabilities and proper use of the gstat program.
This document describes a maximum entropy modeling toolkit that provides conditional maximum entropy models, L-BFGS and GIS parameter estimation algorithms, Gaussian prior smoothing, C++ and Python APIs. It discusses building, installing and using the toolkit on various operating systems. It also provides tutorials on maximum entropy modeling concepts and using the toolkit's features and APIs.
This document is a preface and table of contents for a book titled "Picking Up Perl" that teaches Perl programming to new users. The preface outlines that the book is a tutorial intended for beginners to learn Perl version 5.6.0. It also covers the book's purpose, acknowledgments, obtaining updates, intended audience, topics covered, and conventions used. The table of contents provides an overview of the 7 chapters and their sections that make up the content of the book, including getting started, scalars, arrays, control structures, hashes, regular expressions, and subroutines.
This document is a reference manual for Pajek, a program for analyzing and visualizing large networks. Pajek was developed in 1996 and is implemented in Delphi. It allows users to load, analyze, visualize and export large networks with thousands or millions of nodes. The manual describes Pajek's commands and functions for network analysis, visualization and exporting network images.
The document provides an overview of the C preprocessor, which is a macro processor that transforms C code before compilation. It covers preprocessing tasks like handling headers, macros, conditionals, and other directives. It also describes the traditional mode for backward compatibility with older code and implementations.
The document discusses the basics of PSTricks, a package for creating graphics in LaTeX documents. It covers starting PSTricks, basic concepts like arguments, colors, and dimensions. It also describes how to draw common geometric objects like lines, polygons, circles, and curves. Specific commands are provided with examples to illustrate how to draw these objects with PSTricks. The document is a tutorial introduction for learning the fundamentals of the PSTricks package.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 1 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
This document provides an introduction to using R, an open-source programming language and software environment for statistical analysis and graphics. It covers basic R operations like vectors, arrays, matrices, data frames, reading data, probability distributions, and writing functions. The document contains copyright information and a table of contents describing its 10 chapters on getting started with R and its core functionality.
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
C++ programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document provides a quick introduction to the Perl scripting language. It discusses variables including scalars, arrays, hashes, and references. It also covers basic concepts like conditionals, subroutines, string manipulation, modules/packages, object-oriented programming, and debugging in Perl. The goal is to enable readers to quickly learn Perl fundamentals and become proficient at writing simple programs.
This document appears to be the introduction and first few sections of a seminar paper on triangulation methods. It introduces basic concepts of epipolar geometry including the epipolar plane, epipoles, fundamental matrix, and essential matrix. It discusses how these mathematical concepts describe the relationships between 3D points and their 2D projections in multiple images. The document provides foundations for later sections that will describe methods for reconstructing 3D points from stereo image pairs using triangulation.
Climb - A Generic and Dynamic Approach to Image ProcessingChristopher Chedeau
LRDE (EPITA Research & Development Lab http://www.lrde.epita.fr/) Seminar: A Generic and Dynamic Approach to Image Processing
Abstract: "Climb is a generic image processing library. A case study of the erosion algorithm from mathematical morphology highlights the issues of a non-generic implementation. Structures such as Image, Site Set and Accumulator are defined to solve them. Genericity is even increased by the concept of Morphers: a way to alter the communication between an object and the outside world. All these additions are done using the dynamic aspect of Lisp that allows for rapid prototyping."
Olena - http://olena.lrde.epita.fr/
Alexis Green and Samantha Stevens are mentioned in the document. The document also provides biographical information about Nancy Edwards, including that she has taught hearing impaired students for 30 years near Lake Huron, has had magazine stories and books published, and provides her website and email for contact information.
The document discusses the history of calculating machines from Napier's bones in the 16th century to the analytical engine in the 19th century. Key figures mentioned include Napier, Pascal, Leibnitz, Jacquard, Babbage, and Lady Ada who worked on Babbage's analytical engine, one of the first general-purpose computers. The document traces the development of mechanical calculating devices over centuries.
This user manual provides instructions for using Scrivener 2.1 software. It includes sections on installation and interface overview, project management, outlining and organizing documents, writing and editing tools, compiling drafts into final formats like PDF and HTML, and customizing preferences. The manual contains over 400 pages with detailed explanations and screenshots to help users maximize the power of Scrivener for drafting, organizing, and compiling a variety of creative works and documents.
Notes of 8085 micro processor Programming for BCA, MCA, MSC (CS), MSC (IT) &...ssuserd6b1fd
If you are beginners in 8085 micro processor and wants to be a professional in 8085 micro processor programming then read this notes. It surely helped you in understanding of 8085 micro processor from bottom to top.
This document provides an advanced guide for developing macros in IBM Rational Host Access Transformation Services (HATS). It covers macro structure, data types, operators, expressions, how the macro runtime processes macros, screen description and recognition, and available macro actions. The guide contains definitions of terms and includes conceptual diagrams and code samples to illustrate macro concepts and functionality. It is intended to help macro developers better understand and utilize the full capabilities of the HATS macro language.
This document provides an advanced guide for developing macros in IBM Rational Host Access Transformation Services (HATS). It covers macro structure, data types, operators, expressions, how the macro runtime processes macros, screen description and recognition, and available macro actions. The guide contains definitions of terms and includes conceptual diagrams and code samples to illustrate macro design and processing. It is intended to help macro developers better understand and utilize the full capabilities of the HATS macro language.
This document provides a summary of Linux advanced routing and traffic control techniques. It covers topics like routing with iproute2, policy routing, GRE and other tunneling methods, IPv6 tunneling, IPsec, multicast routing, traffic shaping with different queueing disciplines, load balancing across interfaces, packet marking with Netfilter, advanced packet filtering, kernel network parameters, and other advanced queueing disciplines. The goal is to provide hands-on guidance for configuring and managing routing, traffic control, and related Linux networking functions.
This document provides a user manual for gstat, a program for geostatistical modeling, prediction, and simulation of spatial data in one, two or three dimensions. Gstat allows for variogram modeling, kriging (prediction), and simulation using a variety of methods. It supports many data formats and provides a flexible command language for controlling geostatistical analyses. The manual describes the capabilities and proper use of the gstat program.
This document describes a maximum entropy modeling toolkit that provides conditional maximum entropy models, L-BFGS and GIS parameter estimation algorithms, Gaussian prior smoothing, C++ and Python APIs. It discusses building, installing and using the toolkit on various operating systems. It also provides tutorials on maximum entropy modeling concepts and using the toolkit's features and APIs.
This document is a preface and table of contents for a book titled "Picking Up Perl" that teaches Perl programming to new users. The preface outlines that the book is a tutorial intended for beginners to learn Perl version 5.6.0. It also covers the book's purpose, acknowledgments, obtaining updates, intended audience, topics covered, and conventions used. The table of contents provides an overview of the 7 chapters and their sections that make up the content of the book, including getting started, scalars, arrays, control structures, hashes, regular expressions, and subroutines.
This document is a reference manual for Pajek, a program for analyzing and visualizing large networks. Pajek was developed in 1996 and is implemented in Delphi. It allows users to load, analyze, visualize and export large networks with thousands or millions of nodes. The manual describes Pajek's commands and functions for network analysis, visualization and exporting network images.
The document provides an overview of the C preprocessor, which is a macro processor that transforms C code before compilation. It covers preprocessing tasks like handling headers, macros, conditionals, and other directives. It also describes the traditional mode for backward compatibility with older code and implementations.
The document discusses the basics of PSTricks, a package for creating graphics in LaTeX documents. It covers starting PSTricks, basic concepts like arguments, colors, and dimensions. It also describes how to draw common geometric objects like lines, polygons, circles, and curves. Specific commands are provided with examples to illustrate how to draw these objects with PSTricks. The document is a tutorial introduction for learning the fundamentals of the PSTricks package.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 1 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
This document provides an introduction to using R, an open-source programming language and software environment for statistical analysis and graphics. It covers basic R operations like vectors, arrays, matrices, data frames, reading data, probability distributions, and writing functions. The document contains copyright information and a table of contents describing its 10 chapters on getting started with R and its core functionality.
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
C++ programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document provides a quick introduction to the Perl scripting language. It discusses variables including scalars, arrays, hashes, and references. It also covers basic concepts like conditionals, subroutines, string manipulation, modules/packages, object-oriented programming, and debugging in Perl. The goal is to enable readers to quickly learn Perl fundamentals and become proficient at writing simple programs.
This document appears to be the introduction and first few sections of a seminar paper on triangulation methods. It introduces basic concepts of epipolar geometry including the epipolar plane, epipoles, fundamental matrix, and essential matrix. It discusses how these mathematical concepts describe the relationships between 3D points and their 2D projections in multiple images. The document provides foundations for later sections that will describe methods for reconstructing 3D points from stereo image pairs using triangulation.
Climb - A Generic and Dynamic Approach to Image ProcessingChristopher Chedeau
LRDE (EPITA Research & Development Lab http://www.lrde.epita.fr/) Seminar: A Generic and Dynamic Approach to Image Processing
Abstract: "Climb is a generic image processing library. A case study of the erosion algorithm from mathematical morphology highlights the issues of a non-generic implementation. Structures such as Image, Site Set and Accumulator are defined to solve them. Genericity is even increased by the concept of Morphers: a way to alter the communication between an object and the outside world. All these additions are done using the dynamic aspect of Lisp that allows for rapid prototyping."
Olena - http://olena.lrde.epita.fr/
Alexis Green and Samantha Stevens are mentioned in the document. The document also provides biographical information about Nancy Edwards, including that she has taught hearing impaired students for 30 years near Lake Huron, has had magazine stories and books published, and provides her website and email for contact information.
The document discusses the history of calculating machines from Napier's bones in the 16th century to the analytical engine in the 19th century. Key figures mentioned include Napier, Pascal, Leibnitz, Jacquard, Babbage, and Lady Ada who worked on Babbage's analytical engine, one of the first general-purpose computers. The document traces the development of mechanical calculating devices over centuries.
The document discusses the fundamentals of personal computers. It describes the basic functions of a PC as accepting data input from the user, storing data, processing the input using instructions, and displaying the processed data through output devices. It then categorizes types of computers as microcomputers, minicomputers, mainframes, and supercomputers, describing their typical uses, sizes, processing speeds, and other characteristics. Finally, it outlines the main components of a PC, including input devices, output devices, storage devices, processing devices, communication devices, and infrastructure.
This document provides an overview of Chester High School for the 2012-2013 school year. It includes:
1) The administrative staff, mission statement, and new faculty members.
2) Improvements made to school facilities over the summer.
3) Expectations for teachers, including work hours, supervision of students, and maintaining grades in PowerSchool.
4) Information about guidance counselors, the discipline process, and other school procedures and policies.
The document aims to inform teachers of changes and expectations for the upcoming school year at Chester High School
WorldCat is a library catalog that combines the collections of over 72,000 libraries in 170 countries. It allows users to search for books, articles, and other resources. Users can perform basic searches or more advanced searches, and the results will show how many items are available under different categories or locations to help the user find items at a local library. WorldCat can also be accessed via mobile devices and provides additional features like book lists, bibliography building, and book reviews.
WorldCat is a library catalog that combines the collections of over 72,000 libraries in 170 countries. It allows users to search for books, articles, and other resources. Users can perform basic searches by keyword or more advanced searches by filtering results. WorldCat also enables users to check if a local library has an item, build bibliographies, read book reviews, and request items not available through WorldCat directly from their library.
This document discusses the potential benefits and harms of big data. It begins by defining big data according to its four characteristics: volume, velocity, variety, and veracity. Examples are given of how big data is collected from everyday activities through digital traces and sensors. Potential benefits discussed include healthcare applications like disease prediction and electronic health records, more accurate insurance through telematics, and improved job recruiting. However, concerns are also raised about privacy and security issues with health data, a lack of transparency and potential unfairness in insurance pricing and job algorithms. In conclusion, while big data can increase understanding, it also risks exacerbating inequalities if not approached carefully.
The document appears to contain a date range from December 13, 1955 to November 9, 2012, spanning nearly 57 years. It does not provide any other context or details within the date range. The essential information conveyed is a lifetime span between two dates.
Originally presented on January 22, 2017 at NamesCon, this presentation served as a primer on the NamesCon app, as well as describing best practices for Twitter, Facebook, LinkedIn, and Instagram. The purpose: help domain-name industry professionals tell better stories. Co-presented with Stephanie Mercier Voyer (@smvoyer). The text got a bit squeezed in the translation from Google Slides to PowerPoint.
Dokumen tersebut membahas tentang perencanaan pesan-pesan bisnis, termasuk pendefinisian perencanaan pesan, proses komposisi pesan, penentuan tujuan komunikasi, analisis audience, penentuan ide pokok, dan seleksi saluran dan media komunikasi.
Chapter 16-marginal-costing and cvp analysisAshvin Vala
Marginal costing and CVP analysis are important management accounting techniques. Marginal costing involves separating total costs into fixed and variable components. It focuses on variable costs and marginal costs. CVP analysis examines the relationship between costs, volume, and profits. It is used to determine the break-even point and margin of safety. CVP provides important information for decision-making, budgeting, pricing, and performance evaluation.
This document specifies the devicetree format. It defines the structure and conventions for representing hardware resources and connections in a device tree. This includes node names, properties, memory map representation, interrupt mapping, and the flattened device tree binary format. The goal is to provide a standardized representation of platform hardware across embedded and mobile systems.
The paperback version is available on lulu.com there http://goo.gl/fraa8o
This is the first volume of the postgresql database administration book. The book covers the steps for installing, configuring and administering a PostgreSQL 9.3 on Linux debian. The book covers the logical and physical aspect of PostgreSQL. Two chapters are dedicated to the backup/restore topic.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document contains an introduction to programming concepts, getting started with Perl, manipulating data structures in Perl like scalars, lists, arrays and hashes. It also covers operators, conditionals, loops, subroutines and other Perl concepts. The author provides their contact information and requests feedback to improve the quality of the publication.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document describes the Embedded Filesystem Library (EFSL), which provides filesystem functionality for embedded systems. It allows accessing files stored on various storage devices from different microcontroller families. The document explains how to set up and compile EFSL for Linux, AVR, DSP and ARM microcontrollers. It provides examples and describes the EFSL API functions for opening, reading, writing and managing files and directories. It also gives notes for EFSL configuration and developing for new hardware targets.
The document outlines the author's preparation for coding interviews at Google, including a review of important data structures, algorithms, and problem domains. The author plans to thoroughly review arrays, trees, graphs, dynamic programming, recursion, sorting, strings, caching, game theory, computability, bitwise operators, math, concurrency, and system design. They will also practice solving problems involving arrays, strings, trees, graphs, divide-and-conquer, dynamic programming, and more. The single document the author intends to bring summarizes their background, projects, most difficult bugs, and other experiences that may be relevant questions during the interview.
This thesis submitted by Joshua Landwehr to the University of Delaware examines the Tapestry execution and synchronization models for parallel programming. Tapestry uses a threaded dependency model where actors are represented as threads and dependencies between actors control execution flow. The thesis describes the key components of the Tapestry model including actors, states, arcs, loops, pipelines, and how it supports various execution models. It also provides details on the Tapestry framework, threads implementation, and fibers runtime and evaluates Tapestry on benchmarks like Fibonacci and N-Queens.
This document is the Bash Reference Manual for version 4.2 of the GNU Bash shell. It provides documentation on Bash's features, including basic shell syntax and operations, shell commands, parameters, expansions, redirections, and built-in commands. The manual is published by the Free Software Foundation and was last updated in December 2010.
This document provides an overview and introduction to using Biopython, an open source Python library for biological sequence analysis. It covers topics such as installing Biopython, working with sequence objects, parsing sequence files, connecting to biological databases, multiple sequence alignments, and BLAST searches. The goal is to explain the key capabilities and functionalities available in Biopython through examples and tutorials.
This document summarizes the features of the Bash shell version 4.3, last updated in February 2014. It provides definitions of key terms, an overview of basic shell features like syntax, commands, parameters and expansions. It also describes shell scripting, builtin commands, variables and other Bash-specific features. The manual is intended as a reference for using and programming with the Bash shell.
This document outlines an internal Barco training on embedded Linux for engineering. It covers topics like cross-compilation toolchains, the Linux boot process, bootloaders, and the Linux kernel, including building a kernel, device trees, device drivers, and a real-life Barco example. Hands-on sections provide examples for exploring U-Boot, replacing a bootloader, building a kernel, and more.
This document is a Python tutorial that provides an overview of the Python programming language. It covers topics like using the Python interpreter, basic syntax like variables and data types, control flow tools like if/else statements and for loops, defining functions, working with data structures like lists, tuples and dictionaries, modules and packages, input/output functions, exceptions and errors, and an introduction to classes. The tutorial is intended to help new Python programmers get started with the basics of the language.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003 under a Creative Commons license. The document provides an introduction to Perl and teaches the fundamentals of Perl programming, including data structures, operators, conditionals, loops, subroutines, references and more. It aims to help readers learn Perl and further improve the quality of the tutorial through reader feedback.
Metatron Technology Consulting 's MySQL to PostgreSQL ...webhostingguy
This document provides a guide for migrating a database from MySQL to PostgreSQL. It discusses key differences between the two databases, including features available in one but not the other. It also provides references for porting SQL functions and tools to help with the migration process. Common problems that may occur during migration like error messages are also addressed.
Makefiles are used to help decide which parts of a large program need to be recompiled. In the vast majority of cases, C or C++ files are compiled. Other languages typically have their own tools that serve a similar purpose as Make. Make can also be used beyond compilation too, when you need a series of instructions to run depending on what files have changed. This tutorial will focus on the C/C++ compilation use case.
This document provides a detailed overview of the internals of the GNU debugger (GDB), including its overall structure, key algorithms, user interface, symbol handling, and other components. It describes GDB's symbol side for accessing program symbols and debugging information, target side for communicating with the debugged process, and configurations for different operating systems and architectures. The document also examines GDB's algorithms for tasks like breakpoint handling, single stepping, watchpoints, and unwinds stack frames to locate values. It provides details on GDB's UI, use of libgdb for CLI support, handling of values and types, and support for various object file and debugging formats.
This is the printout version of my lecture slides for the OS course. It includes more details (quations from books, references, etc.) than the slides version.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
1. The algorithmicx package∗
Sz´sz J´nos
a a
szaszjanos@users.sourceforge.net
November 28, 2012
Abstract
The algorithmicx package provides many possibilities to customize
the layout of algorithms. You can use one of the predefined layouts
(pseudocode, pascal and c and others), with or without modifications,
or you can define a completely new layout for your specific needs.
Contents
1 Introduction 1
2 General informations 2
2.1 The package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 The algorithmic block . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Simple lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.4 Placing comments in sources . . . . . . . . . . . . . . . . . . . . 3
2.5 Labels and references . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.6 Breaking up long algorithms . . . . . . . . . . . . . . . . . . . . . 3
2.7 Multiple layouts in the same document . . . . . . . . . . . . . . . 4
3 The predefined layouts 4
3.1 The algpseudocode layout . . . . . . . . . . . . . . . . . . . . . 4
3.1.1 The for block . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2 The while block . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3 The repeat block . . . . . . . . . . . . . . . . . . . . . . 6
3.1.4 The if block . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.5 The procedure block . . . . . . . . . . . . . . . . . . . . 7
3.1.6 The function block . . . . . . . . . . . . . . . . . . . . . 7
3.1.7 The loop block . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.8 Other commands in this layout . . . . . . . . . . . . . . . 8
3.1.9 Package options . . . . . . . . . . . . . . . . . . . . . . . . 8
∗ This is the documentation for the version 1.2 of the package. This package is released
under LPPL.
1
2. 3.1.10 Changing command names . . . . . . . . . . . . . . . . . 9
3.2 The algpascal layout . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.1 The begin . . . end block . . . . . . . . . . . . . . . . . . 10
3.2.2 The for loop . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.3 The while loop . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.4 The repeat. . . until block . . . . . . . . . . . . . . . . . 11
3.2.5 The if command . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.6 The procedure command . . . . . . . . . . . . . . . . . . 11
3.2.7 The function command . . . . . . . . . . . . . . . . . . . 11
3.3 The algc layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Custom algorithmic blocks 12
4.1 Blocks and loops . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Defining blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Defining loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Continuing blocks and loops . . . . . . . . . . . . . . . . . . . . . 15
4.5 Even more customisation . . . . . . . . . . . . . . . . . . . . . . 16
4.6 Parameters, custom text . . . . . . . . . . . . . . . . . . . . . . . 18
4.7 The ONE defining macro . . . . . . . . . . . . . . . . . . . . . . 19
5 Examples 21
5.1 A full example using algpseudocode . . . . . . . . . . . . . . . 21
5.2 Breaking up an algorithm . . . . . . . . . . . . . . . . . . . . . . 23
5.3 Using multiple layouts . . . . . . . . . . . . . . . . . . . . . . . . 25
6 Bugs 27
1 Introduction
All this has begun in my last year at the university. The only thing that I knew
of L TEX was that it exists, and that it is “good”. I started using it, but I needed
A
to typeset some algorithms. So I begun searching for a good algorithmic style,
and I have found the algorithmic package. It was a great joy for me, and I
started to use it. . . Well. . . Everything went nice, until I needed some block
that wasn’t defined in there. What to do? I was no L TEX guru, in fact I only
A
knew the few basic macros. But there was no other way, so I opened the style
file, and I copied one existing block, renamed a few things, and voil`! This (and
a
some other small changes) where enough for me. . .
One year later — for one good soul — I had to make some really big changes
on the style. And there on a sunny day came the idea. What if I would write
some macros to let others create blocks automatically? And so I did! Since then
the style was completely rewritten. . . several times. . .
I had fun writing it, may you have fun using it! I am still no L TEX guru, so
A
if you are, and you find something really ugly in the style, please mail me! All
ideas for improvements are welcome!
2
3. Thanks go to Benedek Zsuzsa, Ionescu Clara, Sz˝cs Zolt´n, Cseke Botond,
o a
Kanoc and many-many others. Without them I would have never started or
continued algorithmicx.
2 General informations
2.1 The package
The package algorithmicx itself doesn’t define any algorithmic commands,
but gives a set of macros to define such a command set. You may use only
algorithmicx, and define the commands yourself, or you may use one of the
predefined command sets.
These predefined command sets (layouts) are:
algpseudocode has the same look1 as the one defined in the algorithmic
package. The main difference is that while the algorithmic package
doesn’t allow you to modify predefined structures, or to create new ones,
the algorithmicx package gives you full control over the definitions (ok,
there are some limitations — you can not send mail with a, say, For
command).
algcompatible is fully compatible with the algorithmic package, it should
be used only in old documents.
algpascal aims to create a formatted pascal program, it performs automatic
indentation (!), so you can transform a pascal program into an algpascal
algorithm description with some basic substitution rules.
algc – yeah, just like the algpascal. . . but for c. . . This layout is incomplete.
To create floating algorithms you will need algorithm.sty. This file may or
may not be included in the algorithmicx package. You can find it on CTAN,
in the algorithmic package.
2.2 The algorithmic block
Each algorithm begins with the begin{algorithmic}[lines] command, the
optional lines controls the line numbering: 0 means no line numbering, 1
means number every line, and n means number lines n, 2n, 3n. . . until the
end{algorithmic} command, witch ends the algorithm.
2.3 Simple lines
A simple line of text is beginned with State. This macro marks the begin
of every line. You don’t need to use State before a command defined in the
package, since these commands use automatically a new line.
1 almost :-)
3
4. To obtain a line that is not numbered, and not counted when counting the
lines for line numbering (in case you choose to number lines), use the Statex
macro. This macro jumps into a new line, the line gets no number, and any
label will point to the previous numbered line.
We will call stataments the lines starting with State. The Statex lines
are not stataments.
2.4 Placing comments in sources
Comments may be placed everywhere in the source using the Comment macro
(there are no limitations like those in the algorithmic package), feel the free-
dom! If you would like to change the form in witch comments are displayed,
just change the algorithmiccomment macro:
algrenewcommand{algorithmiccomment}[1]{hskip3em$rightarrow$ #1}
will result:
1: x←x+1 → Here is the new comment
2.5 Labels and references
Use the label macro, as usual to label a line. When you use ref to reference
the line, the ref will be subtitued with the corresponding line number. When
using the algorithmicx package togedher with the algorithm package, then
you can label both the algorithm and the line, and use the algref macro to
reference a given line from a given algorithm:
algref{<algorithm>}{<line>}
The textbf{while} in algorithm The while in algorithm 1 ends in line 7,
ref{euclid} ends in line so 1.7 is the line we seek.
ref{euclidendwhile}, so
algref{euclid}{euclidendwhile}
is the line we seek.
2.6 Breaking up long algorithms
Sometimes you have a long algorithm that needs to be broken into parts, each
on a separate float. For this you can use the following:
algstore{<savename>} saves the line number, indentation, open blocks of
the current algorithm and closes all blocks. If used, then this must be the
last command before closing the algorithmic block. Each saved algorithm
must be continued later in the document.
algstore*{<savename>} Like the above, but the algorithm must not be con-
tinued.
4
5. algrestore{<savename>} restores the state of the algorithm saved under
<savename> in this algorithmic block. If used, then this must be the first
command in an algorithmic block. A save is deleted while restoring.
algrestore*{<savename>} Like the above, but the save will not be deleted,
so it can be restored again.
See example in the Examples section.
2.7 Multiple layouts in the same document
You can load multiple algorithmicx layouts in the same document. You can
switch between the layouts using the alglanguage{<layoutname>} command.
After this command all new algorithmic environments will use the given layout
until the layout is changed again.
3 The predefined layouts
3.1 The algpseudocode layout
If you are familiar with the algorithmic package, then you’ll find it easy to
switch. You can use the old algorithms with the algcompatible layout, but
please use the algpseudocode layout for new algorithms.
To use algpseudocode, simply load algpseudocode.sty:
usepackage{algpseudocode}
You don’t need to manually load the algorithmicx package, as this is done
by algpseudocode.
The first algorithm one should write is the first algorithm ever (ok, an im-
proved version), Euclid’s algorithm:
Algorithm 1 Euclid’s algorithm
1: procedure Euclid(a, b) The g.c.d. of a and b
2: r ← a mod b
3: while r = 0 do We have the answer if r is 0
4: a←b
5: b←r
6: r ← a mod b
7: end while
8: return b The gcd is b
9: end procedure
Created with the following source:
5
6. begin{algorithm}
caption{Euclid’s algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of a and b}
State $rgets abmod b$
While{$rnot=0$}Comment{We have the answer if r is 0}
State $agets b$
State $bgets r$
State $rgets abmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is b}
EndProcedure
end{algorithmic}
end{algorithm}
The State stands at the beginning of each simple statement; the respective
statement is put in a new line, with the needed indentation. The Procedure
. . . EndProcedure and While . . . EndWhile blocks (like any block defined in
the algpseudocode layout) automatically indent their content. The indenta-
tion of the source doesn’t matter, so
begin{algorithmic}[1]
Repeat 1: repeat forever
Comment{forever} 2: this
State thisUntil{you die.} 3: until you die.
end{algorithmic}
But, generally, it is a good idea to keep the source indented, since you will
find errors much easier. And your tex file looks better!
All examples and syntax descriptions will be shown as the previous example
— the left side shows the L TEX input, and the right side the algorithm, as it
A
appears in your document. I’m cheating! Don’t look in the algorithmicx.tex
file! Believe what the examples state! I may use some undocumented and dirty
stuff to create all these examples. You might be more confused after opening
algorithmicx.tex as you was before.
In the case of syntax descriptions the text between < and > is symbolic,
so if you type what you see on the left side, you will not get the algorithm on
the right side. But if you replace the text between < > with a proper piece of
algorithm, then you will probably get what you want. The parts between [ and
] are optional.
3.1.1 The for block
The for block may have one of the forms:
For{<text>} 1: for <text> do
<body> 2: <body>
EndFor 3: end for
6
7. ForAll{<text>} 1: for all <text> do
<body> 2: <body>
EndFor 3: end for
Example:
begin{algorithmic}[1]
State $sumgets 0$ 1: sum ← 0
For{$igets 1, n$} 2: for i ← 1, n do
State $sumgets sum+i$ 3: sum ← sum + i
EndFor 4: end for
end{algorithmic}
3.1.2 The while block
The while block has the form:
While{<text>} 1: while <text> do
<body> 2: <body>
EndWhile 3: end while
Example:
begin{algorithmic}[1]
State $sumgets 0$ 1: sum ← 0
State $igets 1$ 2: i←1
While{$ile n$} 3: while i ≤ n do
State $sumgets sum+i$ 4: sum ← sum + i
State $igets i+1$ 5: i←i+1
EndWhile 6: end while
end{algorithmic}
3.1.3 The repeat block
The repeat block has the form:
Repeat 1: repeat
<body> 2: <body>
Until{<text>} 3: until <text>
Example:
begin{algorithmic}[1]
State $sumgets 0$ 1: sum ← 0
State $igets 1$ 2: i←1
Repeat 3: repeat
State $sumgets sum+i$ 4: sum ← sum + i
State $igets i+1$ 5: i←i+1
Until{$i>n$} 6: until i > n
end{algorithmic}
7
8. 3.1.4 The if block
The if block has the form:
If{<text>} 1: if <text> then
<body> 2: <body>
[ [
ElsIf{<text>} 3: else if <text> then
<body> 4: <body>
... ...
] ]
[ [
Else 5: else
<body> 6: <body>
] ]
EndIf 7: end if
Example:
begin{algorithmic}[1]
If{$qualityge 9$} 1: if quality ≥ 9 then
State $agets perfect$ 2: a ← perf ect
ElsIf{$qualityge 7$} 3: else if quality ≥ 7 then
State $agets good$ 4: a ← good
ElsIf{$qualityge 5$} 5: else if quality ≥ 5 then
State $agets medium$ 6: a ← medium
ElsIf{$qualityge 3$} 7: else if quality ≥ 3 then
State $agets bad$ 8: a ← bad
Else 9: else
State $agets unusable$ 10: a ← unusable
EndIf 11: end if
end{algorithmic}
3.1.5 The procedure block
The procedure block has the form:
Procedure{<name>}{<params>} 1: procedure <name>(<params>)
<body> 2: <body>
EndProcedure 3: end procedure
Example: See Euclid’s algorithm on page 4.
3.1.6 The function block
The function block has the same syntax as the procedure block:
8
9. Function{<name>}{<params>} 1: function <name>(<params>)
<body> 2: <body>
EndFunction 3: end function
3.1.7 The loop block
The loop block has the form:
Loop 1: loop
<body> 2: <body>
EndLoop 3: end loop
3.1.8 Other commands in this layout
The starting conditions for the algorithm can be described with the require
instruction, and its result with the ensure instruction.
A procedure call can be formatted with Call.
Require something Require: something
Ensure something Ensure: something
Statex
State Call{Create}{10} 1: Create(10)
Example:
begin{algorithmic}[1]
Require $xge5$ Require: x ≥ 5
Ensure $xle-5$ Ensure: x ≤ −5
Statex
While{$x>-5$} 1: while x > −5 do
State $xgets x-1$ 2: x←x−1
EndWhile 3: end while
end{algorithmic}
3.1.9 Package options
The algpseudocode package supports the following options:
compatible/noncompatible Obsolote, use the algcompatible layout instead.
If you would like to use old algorithms, written with the algorithmic
package without (too much) modification, then use the compatible op-
tion. This option defines the uppercase version of the commands. Note
that you still need to remove the [...] comments (these comments ap-
peared due to some limitations in the algorithmic package, these limi-
tations and comments are gone now). The default noncompatible does
not define the all uppercase commands.
9
10. noend/end
With noend specified all end . . . lines are omitted. You get a somewhat
smaller algorithm, and the ugly feeling, that something is missing. . . The
end value is the default, it means, that all end . . . lines are in their right
place.
3.1.10 Changing command names
One common thing for a pseudocode is to change the command names. Many
people use many different kind of pseudocode command names. In algpseu-
docode all keywords are declared as algorithmic<keyword>. You can change
them to output the text you need:
algrenewcommandalgorithmicwhile{textbf{am’i g}}
algrenewcommandalgorithmicdo{textbf{v’egezd el}}
algrenewcommandalgorithmicend{textbf{v’ege}}
begin{algorithmic}[1]
State $x gets 1$ 1: x ← 1
While{$x < 10$} 2: am´ x < 10 v´gezd el
ıg e
State $x gets x + 1$ 3: x←x+1
EndWhile 4: v´ge am´
e ıg
end{algorithmic}
In some cases you may need to change even more (in the above example
am´ and v´ge should be interchanged in the EndWhile text). Maybe the
ıg e
number of the parameters taken by some commands must be changed too. this
can be done with the command text customizing macros (see section 4.6). Here
I’ll give only some examples of the most common usage:
algrenewcommandalgorithmicwhile{textbf{am’i g}}
algrenewcommandalgorithmicdo{textbf{v’egezd el}}
algrenewcommandalgorithmicend{textbf{v’ege}}
algrenewtext{EndWhile}{algorithmicwhile algorithmicend}
begin{algorithmic}[1]
State $x gets 1$ 1: x ← 1
While{$x < 10$} 2: am´ x < 10 v´gezd el
ıg e
State $x gets x - 1$ 3: x←x−1
EndWhile 4: am´ v´ge
ıg e
end{algorithmic}
10
11. algnewcommandalgorithmicto{textbf{to}}
algrenewtext{For}[3]%
{algorithmicfor #1 gets #2 algorithmicto #3 algorithmicdo}
begin{algorithmic}[1]
State $p gets 1$ 1: p ← 1
For{i}{1}{n} 2: for i ← 1 to n do
State $p gets p * i$ 3: p←p∗i
EndFor 4: end for
end{algorithmic}
You could create a translation package, that included after the algpseu-
docode package translates the keywords to the language you need.
3.2 The algpascal layout
The most important feature of the algpascal layout is that it performs auto-
matically the block indentation. In section 4 you will see how to define such
automatically indented loops. Here is an example to demonstrate this feature:
begin{algorithmic}[1]
Begin 1: begin
State $sum:=0$; 2: sum := 0;
For{i=1}{n}Comment{sum(i)} 3: for i = 1 to n do {sum(i)}
State $sum:=sum+i$; 4: sum := sum + i;
State writeln($sum$); 5: writeln(sum);
End. 6: end.
end{algorithmic}
Note, that the For is not closed explicitly, its end is detected automatically.
Again, the indentation in the source doesn’t affect the output. In this layout
every parameter passed to a command is put in mathematical mode.
3.2.1 The begin . . . end block
Begin 1: begin
<body> 2: <body>
End 3: end
The Begin . . . End block and the Repeat . . . Until block are the
only blocks in the algpascal style (instead of Begin you may write Asm).
This means, that every other loop is ended automatically after the following
command (another loop, or a block).
3.2.2 The for loop
For{<assign>}{<expr>} 1: for <assign> to <expr> do
<command> 2: <command>
11
12. The For loop (as all other loops) ends after the following command (a block
counts also as a single command).
begin{algorithmic}[1]
Begin 1: begin
State $sum:=0$; 2: sum := 0;
State $prod:=1$; 3: prod := 1;
For{i:=1}{10} 4: for i := 1 to 10 do
Begin 5: begin
State $sum:=sum+i$; 6: sum := sum + i;
State $prod:=prod*i$; 7: prod := prod ∗ i;
End 8: end
End. 9: end.
end{algorithmic}
3.2.3 The while loop
While{<expression>} 1: while <expression> do
<command> 2: <command>
3.2.4 The repeat. . . until block
Repeat 1: repeat
<body> 2: <body>
Until{<expression>} 3: until <expression>
3.2.5 The if command
If{<expression>} 1: if <expression> then
<command> 2: <command>
[ [
Else 3: else
<command> 4: <command>
] ]
Every Else matches the nearest If.
3.2.6 The procedure command
Procedure <some text> 1: procedure <some text>
Procedure just writes the “procedure” word on a new line... You will
probably put a Begin. . . End block after it.
3.2.7 The function command
Function<some text> 1: function <some text>
Just like Procedure.
12
13. 3.3 The algc layout
Sorry, the algc layout is unfinished. The commands defined are:
• {. . . } block
• For with 3 params
• If with 1 param
• Else with no params
• While with 1 param
• Do with no params
• Function with 3 params
• Return with no params
4 Custom algorithmic blocks
4.1 Blocks and loops
Most of the environments defined in the standard layouts (and most probably
the ones you will define) are divided in two categories:
Blocks are the environments witch contain an arbitrary number of commands
or nested blocks. Each block has a name, begins with a starting command
and ends with an ending command. The commands in a block are indented
by algorithmicindent (or another amount).
If your algorithm ends without closing all blocks, the algorithmicx pack-
age gives you a nice error. So be good, and close them all!
Blocks are all the environments defined in the algpseudocode package,
the Begin . . . End block in the algpascal package, and some other ones.
Loops (Let us call them loops. . . ) The loops are environments that include
only one command, loop or block; a loop is closed automatically after this
command. So loops have no ending commands. If your algorithm (or a
block) ends before the single command of a loop, then this is considered
an empty command, and the loop is closed. Feel free to leave open loops
at the end of blocks!
Loops are most of the environments in the algpascal and algc packages.
For some rare constructions you can create mixtures of the two environments
(see section 4.5). Each block and loop may be continued with another one (like
the If with Else).
13
14. 4.2 Defining blocks
There are several commands to define blocks. The difference is in what is defined
beyond the block. The macro algblock defines a new block with starting and
ending entity.
algblock[<block>]{<start>}{<end>}
The defined commands have no parameters, and the text displayed by them
is textbf{<start>} and textbf{<end>}. You can change these texts later
(4.6).
With algblockdefx you can give the text to be output by the starting and
ending command and the number of parameters for these commands. In the
text reference with #n to the parameter number n. Observe that the text is
given in the form you define or redefine macros, and really, this is what happens.
algblockdefx[<block>]{<start>}{<end>}
[<startparamcount>][<default value>]{<start text>}
[<endparamcount>][<default value>]{<end text>}
This defines a new block called <block>, <start> opens the block, <end>
closes the block, <start> displays <start text>, and has <startparamcount>
parameters, <end> displays <end text>, and has <endparamcount> parame-
ters. For both <start> and <end>, if <default value> is given, then the first
parameter is optional, and its default value is <default value>.
If you want to display different text (and to have a different number of param-
eters) for <end> at the end of different blocks, then use the algblockx macro.
Note that it is not possible to display different starting texts, since it is not possi-
ble to start different blocks with the same command. The <start text> defined
with algblockx has the same behavior as if defined with algblockdefx. All
ending commands not defined with algblockx will display the same text, and
the ones defined with this macro will display the different texts you specified.
algblockx[<block>]{<start>}{<end>}
[<startparamcount>][<default value>]{<start text>}
[<endparamcount>][<default value>]{<end text>}
If in the above definitions the <block> is missing, then the name of the
starting command is used as block name. If a block with the given name already
exists, these macros don’t define a new block, instead this it will be used the
defined block. If <start> or <end> is empty, then the definition does not define
a new starting/ending command for the block, and then the respective text
must be missing from the definition. You may have more starting and ending
commands for one block. If the block name is missing, then a starting command
must be given.
14
15. algblock[Name]{Start}{End}
algblockdefx[NAME]{START}{END}%
[2][Unknown]{Start #1(#2)}%
{Ending}
algblockdefx[NAME]{}{OTHEREND}%
[1]{Until (#1)}
begin{algorithmic}[1]
Start 1: Start
Start 2: Start
START[One]{x} 3: Start One(x)
END 4: Ending
START{0} 5: Start Unknown(0)
OTHEREND{texttt{True}} 6: Until (True)
End 7: End
Start 8: Start
End 9: End
End 10: End
end{algorithmic}
4.3 Defining loops
The loop defining macros are similar to the block defining macros. A loop has
no ending command and ends after the first state, block or loop that follows the
loop. Since loops have no ending command, the macro algloopx would not
have mutch sense. The loop defining macros are:
algloop[<loop>]{<start>}
algloopdefx[<loop>]{<start>}
[<startparamcount>][<default value>]{<start text>}
Both create a loop named <loop> with the starting command <start>. The
second also sets the number of parameters, and the text displayed by the starting
command.
15
16. algloop{For}
algloopdefx{If}[1]{textbf{If} #1 textbf{then}}
algblock{Begin}{End}
begin{algorithmic}[1]
For 1: For
Begin 2: Begin
If{$a < b$} 3: If a < b then
For 4: For
Begin 5: Begin
End 6: End
Begin 7: Begin
End 8: End
End 9: End
end{algorithmic}
4.4 Continuing blocks and loops
For each block/loop you may give commands that close the block or loop and
open another block or loop. A good example for this is the if . . . then . . . else
construct. The new block or loop can be closed or continued, as any other blocks
and loops.
To create a continuing block use one of the following:
algcblock[<new block>]{<old block>}{<continue>}{<end>}
algcblockdefx[<new block>]{<old block>}{<continue>}{<end>}
[<continueparamcount>][<default value>]{<continue text>}
[<endparamcount>][<default value>]{<end text>}
algcblockx[<new block>]{<old block>}{<continue>}{<end>}
[<continueparamcount>][<default value>]{<continue text>}
[<endparamcount>][<default value>]{<end text>}
All three macros define a new block named <new block>. If <new block>
is not given, then <continue> is used as the new block name. It is not allowed
to have both <new block> missing, and <continue> empty. The <continue>
command ends the <old block> block/loop and opens the <new block> block.
Since <continue> may end different blocks and loops, it can have different text
at the end of the different blocks/loops. If the <continue> command doesn’t
find an <old block> to close, then an error is reported.
Create continuing loops with the followings:
algcloop[<new loop>]{<old block>}{<continue>}
algcloopdefx[<new loop>]{<old block>}{<continue>}
[<continueparamcount>][<default value>]{<continue text>}
16
17. algcloopx[<new loop>]{<old block>}{<continue>}
[<continueparamcount>][<default value>]{<continue text>}
These macros create a continuing loop, the <continue> closes the <old block>
block/loop, and opens a <new loop> loop.
algblock{If}{EndIf}
algcblock[If]{If}{ElsIf}{EndIf}
algcblock{If}{Else}{EndIf}
algcblockdefx[Strange]{If}{Eeee}{Oooo}
[1]{textbf{Eeee} "#1"}
{textbf{Wuuuupsdots}}
begin{algorithmic}[1]
If 1: If
If 2: If
ElsIf 3: ElsIf
ElsIf 4: ElsIf
If 5: If
ElsIf 6: ElsIf
Else 7: Else
EndIf 8: EndIf
EndIf 9: EndIf
If 10: If
EndIf 11: EndIf
Eeee{Creep} 12: Eeee ”Creep”
Oooo 13: Wuuuups. . .
end{algorithmic}
algloop{If}
algcloop{If}{Else}
algblock{Begin}{End}
begin{algorithmic}[1]
If 1: If
Begin 2: Begin
End 3: End
Else 4: Else
If 5: If
Begin 6: Begin
End 7: End
end{algorithmic}
4.5 Even more customisation
With the following macros you can give the indentation used by the new block
(or loop), and the number of stataments after that the ”block” is automatically
17
18. closed. This value is ∞ for blocks, 1 for loops, and 0 for stataments. There is a
special value, 65535, meaning that the defined ”block” does not end automat-
ically, but if it is enclosed in a block, then the ending command of the block
closes this ”block” as well.
algsetblock[<block>]{<start>}{<end>}
{<lifetime>}{<indent>}
algsetblockdefx[<block>]{<start>}{<end>}
{<lifetime>}{<indent>}
[<startparamcount>][<default value>]{<start text>}
[<endparamcount>][<default value>]{<end text>}
algsetblockx[<block>]{<start>}{<end>}
{<lifetime>}{<indent>}
[<startparamcount>][<default value>]{<start text>}
[<endparamcount>][<default value>]{<end text>}
algcsetblock[<new block>]{<old block>}{<continue>}{<end>}
{<lifetime>}{<indent>}
algcsetblockdefx[<new block>]{<old block>}{<continue>}{<stop>}
{<lifetime>}{<indent>}
[<continueparamcount>][<default value>]{<continue text>}
[<endparamcount>][<default value>]{<end text>}
algcsetblockx[<new block>]{<old block>}{<continue>}{<stop>}
{<lifetime>}{<indent>}
[<continueparamcount>][<default value>]{<continue text>}
[<endparamcount>][<default value>]{<end text>}
The <lifetime> is the number of stataments after that the block is closed.
An empty <lifetime> field means ∞. The <indent> gives the indentation of
the block. Leave this field empty for the default indentation. The rest of the
parameters has the same function as for the previous macros.
18
19. algsetblock[Name]{Start}{Stop}{3}{1cm}
algsetcblock[CName]{Name}{CStart}{CStop}{2}{2cm}
begin{algorithmic}[1]
Start 1: Start
State 1 2: 1
State 2 3: 2
State 3 4: 3
State 4 5: 4
Start 6: Start
State 1 7: 1
Stop 8: Stop
State 2 9: 2
Start 10: Start
State 1 11: 1
CStart 12: CStart
State 1 13: 1
State 2 14: 2
State 3 15: 3
Start 16: Start
State 1 17: 1
CStart 18: CStart
State 1 19: 1
CStop 20: CStop
end{algorithmic}
The created environments behave as follows:
• It starts with Start. The nested environments are indented by 1 cm.
• If it is followed by at least 3 environments (stataments), then it closes
automatically after the third one.
• If you put a Stop before the automatic closure, then this Stop closes
the environment. CStart closes a block called Name and opens a new one
called CName and having an indentaion of 2 cm.
• CName can be closed with CStop or it is closed automatically after 2 envi-
ronments.
4.6 Parameters, custom text
With algrenewtext you can change the number of parameters, and the text
displayed by the commands. With algnotext you can makes the vole output
line disappear, but it works only for ending commands, for beginning commands
you will get an incorrect output.
algrenewcommand[<block>]{<command>}
[<paramcount>][<default value>]{<text>}
19
20. algnotext[<block>]{<ending command>}
If <block> is missing, then the default text is changed, and if <block> is
given, then the text displayed at the end of <block> is changed.
To make a command output the default text at the end of a block (say, you
have changed the text for this block), use algdefaulttext.
algdefaulttext[<block>]{<command>}
If the <block> is missing, than the default text itself will be set to the default
value (this is textbf{<command>}).
4.7 The ONE defining macro
All block and loop defining macros call the same macro. You may use this macro
to gain a better acces to what will be defined. This macro is algdef.
algdef{<flags>}...
Depending on the flags the macro can have many forms.
Flag Meaning
s starting command, without text
S starting command with text
c continuing command, without text
C continuing command, with default text
xC continuing command, with block specific text
e ending command, without text
E continuing command, with default text
xE continuing command, with block specific text
N ending command, with default ”no text”
xN ending command, with no text for this block
b block(default)
l loop
L loop closes after the given number of stataments
i indentation specified
The <new block> may be given for any combination of flags, and it is not
allowed to have <new block> missing and <start> missing/empty. For c, C,
xC an old block is expected. For s, S, c, C, xC the <start> must be given.
For e, E, xE, N, xN the <end> must be given. For L the <lifetime> must be
given. For i the <indent> must be given. For S, C, xC the starting text and
related infos must be given. For E, xE the ending text must be given. For each
combination of flags give only the needed parameters, in the following order:
20
21. algdef{<flags>}[<new block>]{<old block>}{<start>}{<end>}
{<lifetime>}{<indent>}
[<startparamcount>][<default value>]{<start text>}
[<endparamcount>][<default value>]{<end text>}
The block and loop defining macros call algdef with the following flags:
Macro Meaning
algblock algdef{se}
algcblock algdef{ce}
algloop algdef{sl}
algcloop algdef{cl}
algsetblock algdef{seLi}
algsetcblock algdef{ceLi}
algblockx algdef{SxE}
algblockdefx algdef{SE}
algcblockx algdef{CxE}
algcblockdefx algdef{CE}
algsetblockx algdef{SxELi}
algsetblockdefx algdef{SELi}
algsetcblockx algdef{CxELi}
algsetcblockdefx algdef{CELi}
algloopdefx algdef{Sl}
algcloopx algdef{Cxl}
algcloopdefx algdef{Cl}
21
22. 5 Examples
5.1 A full example using algpseudocode
documentclass{article}
usepackage{algorithm}
usepackage{algpseudocode}
begin{document}
begin{algorithm}
caption{The Bellman-Kalaba algorithm}
begin{algorithmic}[1]
Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
ForAll {$v in V(G)$}
State $l(v) leftarrow infty$
EndFor
State $l(u) leftarrow 0$
Repeat
For {$i leftarrow 1, n$}
State $min leftarrow l(v_i)$
For {$j leftarrow 1, n$}
If {$min > e(v_i, v_j) + l(v_j)$}
State $min leftarrow e(v_i, v_j) + l(v_j)$
State $p(i) leftarrow v_j$
EndIf
EndFor
State $l’(i) leftarrow min$
EndFor
State $changed leftarrow l not= l’$
State $l leftarrow l’$
Until{$neg changed$}
EndProcedure
Statex
Procedure {FindPathBK}{$v$, $u$, $p$}
If {$v = u$}
State textbf{Write} $v$
Else
State $w leftarrow v$
While {$w not= u$}
State textbf{Write} $w$
State $w leftarrow p(w)$
EndWhile
EndIf
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
22
23. Algorithm 2 The Bellman-Kalaba algorithm
1: procedure BellmanKalaba(G, u, l, p)
2: for all v ∈ V (G) do
3: l(v) ← ∞
4: end for
5: l(u) ← 0
6: repeat
7: for i ← 1, n do
8: min ← l(vi )
9: for j ← 1, n do
10: if min > e(vi , vj ) + l(vj ) then
11: min ← e(vi , vj ) + l(vj )
12: p(i) ← vj
13: end if
14: end for
15: l (i) ← min
16: end for
17: changed ← l = l
18: l←l
19: until ¬changed
20: end procedure
21: procedure FindPathBK(v, u, p)
22: if v = u then
23: Write v
24: else
25: w←v
26: while w = u do
27: Write w
28: w ← p(w)
29: end while
30: end if
31: end procedure
23
24. 5.2 Breaking up an algorithm
documentclass{article}
usepackage{algorithm}
usepackage{algpseudocode}
begin{document}
begin{algorithm}
caption{Part 1}
begin{algorithmic}[1]
Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
ForAll {$v in V(G)$}
State $l(v) leftarrow infty$
EndFor
State $l(u) leftarrow 0$
Repeat
For {$i leftarrow 1, n$}
State $min leftarrow l(v_i)$
For {$j leftarrow 1, n$}
If {$min > e(v_i, v_j) + l(v_j)$}
State $min leftarrow e(v_i, v_j) + l(v_j)$
State Comment For some reason we need to break here!
algstore{bkbreak}
end{algorithmic}
end{algorithm}
And we need to put some additional text betweendots
begin{algorithm}[h]
caption{Part 2}
begin{algorithmic}[1]
algrestore{bkbreak}
State $p(i) leftarrow v_j$
EndIf
EndFor
State $l’(i) leftarrow min$
EndFor
State $changed leftarrow l not= l’$
State $l leftarrow l’$
Until{$neg changed$}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
24
25. Algorithm 3 Part 1
1: procedure BellmanKalaba(G, u, l, p)
2: for all v ∈ V (G) do
3: l(v) ← ∞
4: end for
5: l(u) ← 0
6: repeat
7: for i ← 1, n do
8: min ← l(vi )
9: for j ← 1, n do
10: if min > e(vi , vj ) + l(vj ) then
11: min ← e(vi , vj ) + l(vj )
12: For some reason we need to break here!
And we need to put some additional text between. . .
Algorithm 4 Part 2
13: p(i) ← vj
14: end if
15: end for
16: l (i) ← min
17: end for
18: changed ← l = l
19: l←l
20: until ¬changed
21: end procedure
25
26. 5.3 Using multiple layouts
documentclass{article}
usepackage{algorithm}
usepackage{algpseudocode}
usepackage{algpascal}
begin{document}
alglanguage{pseudocode}
begin{algorithm}
caption{A small pseudocode}
begin{algorithmic}[1]
State $s gets 0$
State $p gets 0$
For{$i gets 1,, 10$}
State $s gets s + i$
State $p gets p + s$
EndFor
end{algorithmic}
end{algorithm}
alglanguage{pascal}
begin{algorithm}
caption{The pascal version}
begin{algorithmic}[1]
State $s := 0$
State $p := 0$
For{i = 1}{10}
Begin
State $s := s + i$
State $p := p + s$
End
end{algorithmic}
end{algorithm}
end{document}
26
27. Algorithm 5 A small pseudocode
1: s ← 0
2: p ← 0
3: for i ← 1, 10 do
4: s←s+i
5: p←p+s
6: end for
Algorithm 6 The pascal version
1: s := 0
2: p := 0
3: for i = 1 to 10 do
4: begin
5: s := s + i
6: p := p + s
7: end
27
28. 6 Bugs
If you have a question or find a bug you can contact me on:
szaszjanos@users.sourceforge.net
If possible, please create a small L TEX example related to your problem.
A
28