The Wayback Machine - https://web.archive.org/web/20090928095250/http://www.codeguru.com:80/cpp/cpp/algorithms/

CodeGuru
Earthweb Search
Login Forums Wireless Jars Gamelan Developer.com
CodeGuru Navigation
RSS Feeds

RSSAll

RSSVC++/C++

RSS.NET/C#

RSSVB

See more EarthWeb Network feeds

follow us on Twitter

Member Sign In
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

jobs.internet.com

internet.commerce
Partners & Affiliates
















Home >> Visual C++ / C++ >> C++ >> Algorithms & Formulas


Algorithms & Formulas

Algorithms & Formulas



[Updated] Permutations in C++
Rating:
Wong Shao Voon - 09/01/2009
The technique of finding permutations also provides source code for the recursive implementation. Also, learn how to use the STL template function next_permutation().

[Updated] Introducing Templates, Iterators, and Temporary Classes
Rating:
Per Nilsson - 03/03/2004
An introduction to templates, iterators, and temporary classes illustrated by an implementation of a red-black tree.

Floyd's All Pairs Shortest Path Algorithm
Rating:
L. Shyamal - 08/11/2003
This algorithm determines a matrix of the shortest distances between every pair of points. (The article was updated.)

BASE 64 Decoding and Encoding Class 2003
Rating:
Jan Raddatz - 05/30/2003
Learn how to do base64 coding and decoding.

Simple Binary Tree Class
Rating: none
DigitalConvict - 09/09/2002
[Update] Binary Search Trees are useful for finding items in a list that changes infrequently. Add and Remove operations are typically expensive since Binary Search Trees require that a tree be balanced. This article illustrates another Binary Tree class.

Implementing the MD5 Algorithm
Rating:
Gary McNickle - 08/14/2002
Take advantage of a secure message-digest algorithm in your applications. Learn the means to easily integrate MD5 into your existing C++ applications using this cross-platform library.

Balanced Binary Tree
Rating:
Per Nilsson - 01/02/2002
This article give a brief, non-academic explanation of what binary trees are about. It also provide source and demo of a generic tree class. Functionality to balance the tree is also described/provided.


Checksum Algorithms



Computing a MS-CHAPv2 Client Response (not yet reviewed)
Rating: none
Eugene Prigorodov - 03/06/2006
Learn about a RFC2759-compliant implementation of the MS-CHAPv2 response calculation algorithm.

RSA MD5 Message Digest
Rating:
N. Stone - 10/30/2002
[Update] C++ implementation of the RSA MD5 message digest algorithm. One minor typo has been corrected.

CRC32: Generating a checksum for a file
Rating:
Brian Friesen - 01/02/2002
This article describes what a CRC is, how to generate them, what they can be used for, and lastly source code showing how it's done.


Combinations



[Updated] Combinations in C++
Rating:
Wong Shao Voon - 09/14/2009
Learn about a simple algorithm to find combinations systematically using C++.

[Updated] Combinations in C++, Part 2
Rating: none
Wong Shao Voon - 03/17/2009
Discover four new algorithms for finding combinations.

[Updated] Dynamic Programming: Combination Sum Problem
Rating:
Nirav Bhatt - 08/25/2008
Find the coin combinations that add up to a dollar.

Finding Permutations—Easier and Faster
Rating:
srini_gct - 07/09/2004
Learn about the technique of finding permutations in a simple and fast manner. It also provides the source code for the same.


Compression/Decompression



[Updated] Five Cents on Arithmetic Encoding
Rating:
Aliaksei Sanko - 08/24/2009
Learn about a classical arithmetic compression implementation (CACM) optimization.

zlib: Add Industrial Strength Compression to Your C/C++ Apps
Rating:
Victor Volkman - 04/10/2006
The zlib compression library enables developers to integrate lossless compression into their application suites with ease. The benefits are saved time, space, and therefore money.

A Simple Yet Highly Efficient Compressing Technique
Rating:
Roland Cooper-Bitsch - 03/23/2004
Redundancy is very high in any text material. Simple ordering can lead to compression ratios up to 20:1 in directory listings.

Two Classes for Doing Gzip in Memory
Rating:
Gao Dasheng - 07/09/2003
Do Gzip compression and decompression in memory as well as allocate and deallocate memory automatically. (The demo project was updated.)

Data Compression Methods
Rating:
Hannibal Lecturer - 02/28/2003
Learn about fundamental data compression algorithms including RLE and Grayscale matrix compression.

Optimizing Tip on Adaptive Arithmetic Coding
Rating: none
Alexey V. Shanin - 01/02/2002
Describes an optimization point found in the most commonly used adaptive Witten-Neal-Cleary implementation


Factorials



[Updated] Permutations in C++, Part 2
Rating:
Wong Shao Voon - 03/19/2009
Speed up the work of finding permutations among different processors.

Method of Handling Factorials of Any Size
Rating:
Hai Yi - 01/02/2002
Method uses linked list to capture each digit of factorial result thereby not limiting you to C/C++ types


General



Tip: An Optimized Formula for Alpha Blending Pixels
Rating: none
Wong Shao Voon - 04/02/2009
Discover how to optimize by simplifying the formula.

Making a Class Schedule Using a Genetic Algorithm
Rating: none
Mladen Jankovic - 02/20/2008
Learn how to make a class schedule by using a genetic algorithm.

[Updated] Copy Constructors and Assignment Operators
Rating:
kasajian - 08/31/2007
Copying constructors and assignment operators is easy—once you learn the rules, and you can learn those rules right here.

Properties in C++
Rating:
Mohamed Shuaib - 12/28/2006
Learn how to simulate C# properties in C++.

[Updated] A Deterministic Method of Determining a Document's Modified State
Rating:
Jeffrey Walton - 11/29/2006
Determine when a document has been modified. In the particular case of word processors, most tend to have a "dirty" flag that is set when a user types. This article demonstrates a smarter "dirty" flag that uses probabilistic methods.

Doxygen: A Breath of Fresh Air for API Documentation
Rating:
Victor Volkman - 09/01/2006
The Doxygen documentation system addresses the age-old dilemma of how to keep documentation consistent with actual use cases by extracting it directly from the source code.

Running State Machines-Based Win32/WinCE Programs
Rating:
JeromeWiz - 06/13/2006
Learn how to run state machine application framework-based Win32/WinCE programs using window message hooking technology.

TIP: Half Size Triangular Matrix
Rating:
baxelrod - 01/18/2006
Learn about a technique that allows you to use half the data storage when you have a symmetric distance matrix or other similar triangular matrix.

Anti-Aliased Image Transformation (Aaform)
Rating:
msg555 - 12/19/2005
Given an image and a quadralateral, Aaform will fit the image onto the quadraleteral passed using geometry.

Clone Smart Pointer (clone_ptr)
Rating:
Axter - 09/01/2005
Learn about a non-sharing smart pointer class that can be used with STL containers such as std::map, vector, list, set, and deque. The smart pointer has an assignment operator and greater than operator that call the target object's operator.

[Updated] Delaunay Triangles
Rating:
Sjaak Priester - 07/19/2005
Learn about an algorithm to calculate this intriguing and important data structure in computer graphics.

Convert Numbers to Various Display Formats
Rating:
Ajay Vijayvargiya - 02/11/2005
Learn about a set of several algorithms to convert a given number to various formats. This will add enhancement to your application.

Selecting a Geometrical Object
Rating:
Lea Hayes - 07/09/2004
Learn about a method of selecting a geometrical object which is described by its vertices. This article might be of use if you are creating 2D or 3D shape related software.

Message Digests and Digital Fingerprints
Rating:
James Vanns - 06/15/2004
Learn about an OO implementation of the MD5 algorithm in C++. It does not simply copy Ron Rivest's C code into a class. It was written to help provide a better understanding of MD5 and how C++ and its STL may be used to implement it. The code is not optimised.

A Random Number Generation Technique with Encryption and Genetic Algorithm Applications
Rating:
Andy McGovern - 05/26/2004
This article describes some properties of linear feedback shift registers and provides sample applications of their use in Encryption and Genetic Algorithms.

[Updated] A Demo of an AVL Tree
Rating:
Polo.G.Z - 05/25/2004
Learn about using an AVL Tree, including inserting, removing, and searching a node.

[Updated] Geographic Distance and Azimuth Calculations
Rating:
Andy McGovern - 04/28/2004
This article presents the basics of how to do geographic calculation for a spherical and ellipsoid Earth model, and provides sample code that implements solutions to several interesting geographic calculations.

Functorized Undo/Redo
Rating: none
Alexandre Komyak - 03/04/2004
Discover an implemtation of the Undo/Redo algorithm that marries the algorithm with the functor.

Real-time plot
Rating: none
Jan Vidar Berger - 08/06/1998
Real-time plot


Hash Tables



[Updated] Introduction to Hash Tables
Rating:
Per Nilsson - 08/30/2004
Read a brief, non-academic, explanation of what hash tables are and why they are important.

Easy-to-Use Hash Table
Rating:
Rex Schilasky - 10/09/2003
See how to use a hash table. The example uses a small hash table that works with std::strings as key and any data as member. (The article, demo project, and source code were updated.)


Linked Lists



Creating Custom STL Iterators for Linked Lists
Rating: none
Ian Duff - 05/20/2002
Discover a technique of creating Custom STL iterators for a user defined STL container class.

CLinkedList Doubly Linked List Class
Rating:
Ian Duff - 02/20/2002
Doubly Linked List routines providing the most full-blown functionality that any coder should ever need.


Mathematics



Recursion Primer Using C++, Part 2
Rating:
Zeeshan - 11/18/2008
Further your understanding of recursion.

TIP: Round a Decimal to an Integer
Rating: none
Anpino - 07/09/2008
Discover a more efficient way to round decimals to integers.

Implementing a Simple 2D Object Tracker
Rating:
OlegK - 05/14/2008
Learn how to combine four image alignment algorithms (Lucas-Kanade, forwards-compositional, Baker-Dellaert-Matthews, and Hager-Belhumeur) into a 2D object tracker with dynamic templates and template pixel weights.

Recursion Primer Using C++, Part 1
Rating:
Zeeshan - 04/28/2008
There are many different styles of recursion that can be used in a variety of instances. Learn about the styles and find the one that is best for your current project.

Template Meta Programming and Number Theory
Rating: none
Zeeshan - 08/10/2007
Learn how to implement some basic number theory functions with the help of C++ template meta programming.

Blitz++: Fast, Accurate Numerical Computing in C++
Rating:
Victor Volkman - 01/26/2007
With Blitz++, you can turbo charge C++ so that you get advanced language features but lose its poor performance.

Error Detection Based on Check Digit Schemes
Rating:
Jeffrey Walton - 12/13/2006
Learn about various Check Digit Schemes and how to implement the scheme.

Product Activation Based on RSA Signatures
Rating:
Jeffrey Walton - 12/05/2006
Learn how to create a Signing of Product Keys to validate activations.

[Updated] A Big Integer Package for Use in Visual Basic Written in Visual C++
Rating:
Jeffrey Walton - 11/29/2006
A 'How To' for creating a COM Big Integer Library that uses Visual C++ ATL Wizard and Wei Dai's Crypto++ Library.

Product Keys Based on the Advanced Encryption Standard (AES)
Rating:
Jeffrey Walton - 11/28/2006
Protect Software with Product Keys based on the Advanced Encryption Standard (AES).

[Updated] Fixed Point Math
Rating:
egawtry - 06/15/2006
Learn about a library that creates a new fixed point variable type.

[Updated] Anti-Aliased Image Rotation (Aarot)
Rating:
msg555 - 11/07/2005
Rotate images using geometry.

War of the Worlds: Endianness
Rating:
Marius Bancila - 07/26/2005
Learn about the differences between little- and big-endian representations.

Use Traits Classes for Information About Types
Rating:
Scott Meyers - 05/26/2005
The STL is primarily made up of templates for containers, iterators, and algorithms, but it also has a few utility templates. Learn more in this excerpt from "Effective C++, Third Edition: 55 Specific Ways to Improve Your Programs and Designs."

C++ Math and Fun
Rating:
Zeeshan - 08/19/2004
Number theory is a branch of math that can be very attractive.

[Updated] MFC Template Class CLongInt
Rating:
Thomas Holte - 04/05/2004
The template class template class CLongInt supports long integer arithmetic. The template parameter bits specifies the size of a CLongInt in bits.

A Suite of Discrete Probability Classes
Rating:
Joe Nellis - 02/20/2003
Five discrete probability distributions most common for use in computer simulations, gaming, artificial intelligence decision making, and environment modeling. The classes differ from other routine mathematical attempts at probability computation with a few tricks that extend the range of allowable inputs. A comparison with Monte Carlo techniques to probability computation is given.


Portability Issues



Working with INI Configuration Files Cross-Platform (Win32/Un*x, MBCS/Unicode)
Rating: none
brofield - 04/25/2006
Win32 has a built-in INI file API, but writing cross-platform code is difficult because these functions aren't available on Linux.

Portability of the STL remove_if Algorithm (or The Lack of)
Rating: none
Zeeshan - 01/08/2004
The standard template library [JOS99] defines the remove_if algorithm. However, the standards don't define the implementation. Be careful to avoid portability issues if you use this algorithm.


Searching



Linear Search based algorithm for Mth Lexicographic ordering of Mathematical Permutation and Combina
Rating: none
Joe Mariadassou - 08/12/2009
Algorithms to compute the M-th lexicographic ordering of a permutation or combination and the inverse problem of the rank of a given permutation or sequence.

Sample of a Binary Tree Search
Rating: none
Jose Garcia Garcia - 12/03/2002
Search a string in a big array of string pointers using a simple binary tree search method.


Sorting



Discover the Network Search Capabilities of the Boost Graph Library
Rating:
Victor Volkman - 01/11/2006
Once you commit your data structures to a graph representation with the Boost Graph Library, the possibilities of sorting, searching, and connecting networks are limitless.

SortKeyToMultiValueContainer C++ Container Template
Rating: none
Luca Missora - 03/09/2004
A simple and practical approach to manage a set of data in memory: insertion, sorting, searching by key and scanning of the result set.

The Quick Sort
Rating:
zipcn046 - 02/12/2003
A technique for sorting referred to as a partition-sort. Having a time complexity of NlogN, this is one of the fastest sorting algorithms available.

Insertion Sort Simplified
Rating:
zipcn046 - 02/05/2003
Insertion sort, having the time-complexity of O(N^2), is one of the efficient sorting algorithm.


String Algorithms



[Updated] Tip: String Wrapper for Formatted String Output in C++
Rating:
Michael Furman - 08/11/2008
Learn how to construct a simple and lean string class wrapper that allows you to send formatted output to a string directly.

URI Encoding and Decoding
Rating:
jinq0123 - 11/02/2006
Learn about fast and portable URI encoding and decoding functions that use std::string as the argument and return type, and do the buffer conversion, including '\0'.

Flex Your Lexical Analysis Muscles
Rating:
Victor Volkman - 10/09/2006
The Flex lexical analyzer generator enables you to accurately act on and react to incoming character data streams in a way that is both predictable and debuggable.

Managed Extensions: Parsing CSV Files with Regular Expressions
Rating:
Tom Archer - MSFT - 09/10/2004
Tom Archer illustrates how to parse comma-delimited text—when the data contains quotes, commas, and blanks—and return the data in a managed array.

[Updated] Receiving & Converting Numeric and String Data via Sockets
Rating:
Tom Archer - MSFT - 04/08/2004
Many times a remote system will send a numeric value indicating the length of the data to be received in subsequent receive commands. However, when you start sending and receiving numeric data via sockets, you have to be aware of conversion issues in terms of what type of machine is on the other end of the connection.

Algorithm for Detecting Duplicate/Previously Encountered Strings
Rating: none
Jeremy Cattone - 10/01/2002
Algorithm for Detecting Duplicate/Previously Encountered Strings







internet.commediabistro.comJusttechjobs.comGraphics.com

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs