Background: The man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL 60 programming
Continue ReadingC++: Maximum Triangle Path Sum
Starting from the top of a pyramid of numbers like this, you can walk down going one step on the right or on the left, until you reach the bottom row:
Continue ReadingC++: Levenshtein Distance
template <class T> unsigned int edit_distance(const T& s1, const T& s2) { const size_t len1 = s1.size(), len2 = s2.size(); vect
Continue ReadingC++: Dining Philosophers
The dining philosophers problem illustrates non-composability of low-level synchronization primitives like semaphores. It is a modification of a probl
Continue ReadingC++: File Input/Output
In this task, the job is to create a file called "output.txt", and place in it the contents of the file "input.txt", via an intermediate variable. In
Continue ReadingC++: Luhn Test of Credit Card Numbers
The Luhn test is used by some credit card companies to distinguish valid credit card numbers from what could be a random selection of digits. Those
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 Reading




