Task: Generate a string with N opening brackets (“[”) and N closing brackets (“]”), in some arbitrary order. Determine whether the gen
Continue ReadingC++: Continued Fraction
A number may be represented as a continued fraction (see Mathworld for more information) as follows: The task is to write a program which gen
Continue ReadingC++: Entropy
Calculate the information entropy (Shannon entropy) of a given input string. Entropy is the expected value of the measure of information content in
Continue ReadingC++: Floyd’s Triangle
Floyd's triangle lists the natural numbers in a right triangle aligned to the left where the first row is just 1 successive rows start towards
Continue ReadingC++: Infinity
Write a function which tests if infinity is supported for floating point numbers (this step should be omitted for languages where the language specifi
Continue ReadingC++: Input/Output for Pairs of Numbers
From lines of input starting with a line containing the numbers of pairs to follows, followed by that number of pairs of integers separated by a space
Continue ReadingC++: Execute Only Part of Loop
Quite often one needs loops which, in the last iteration, execute only part of the loop body. The goal of this task is to demonstrate the best way to
Continue ReadingC++: LZW Compression
The Lempel-Ziv-Welch (LZW) algorithm provides lossless data compression. You can read a complete description of it in the Wikipedia article on the sub
Continue ReadingC++: Binary Search
//! \brief A recursive binary search using STL vectors //! \param vec The vector whose elements are to be searched //! \param start The index of
Continue ReadingC++: Generate Chess960 Starting Position
Chess960 is a variant of chess created by world champion Bobby Fisher. Unlike other variants of the game, Chess960 does not require a different materi
Continue Reading




