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++: 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++: 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++: 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++: 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++: Balanced Brackets
Task: Generate a string with N opening brackets (“[”) and N closing brackets (“]”), in some arbitrary order. Determine whether the gen
Continue ReadingC++: Knuth’s Algorithm S
This is a method of randomly sampling n items from a set of M items, with equal probability; where M >= n and M, the number of items is unknown unt
Continue ReadingC++: Greatest Common Divisor
This task requires the finding of the greatest common divisor of two integers. Copied from least common multiple page for the sake of completeness.
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 ReadingC++: Digital Root
The digital root, X, of a number, n, is calculated: find X as the sum of the digits of n find a new X by summing the digits of X, repeating un
Continue Reading




