Rule 30 is considered to be chaotic enough to generate good pseudo-random numbers. As a matter of fact, rule 30 is used by the Mathematica software fo
Continue ReadingC++: Apply a Callback to an Array
In this task, the goal is to take a combined set of elements and apply a function to each element. C-style Array: #include <iostream> //
Continue ReadingC++: Higher-Order Functions
Pass a function as an argument to another function. Function Pointer Works with: g++ version 3.4.2 (mingw-special) C++ can pass function pointers i
Continue ReadingC++: Look-and-Say Sequence
The Look and say sequence is a recursively defined sequence of numbers studied most notably by John Conway. Sequence Definition Take a decimal
Continue ReadingC++: Hamming Numbers
Hamming numbers are numbers of the form . Hamming numbers are also known as ugly numbers and also 5-smooth numbers (numbers whose prime div
Continue ReadingC++: Simple Moving Average
Computing the simple moving average of a series of numbers. The task is to: Create a stateful function/class/instance that takes a period and
Continue ReadingC++: Multifactorial
The factorial of a number, written as n! is defined as n! = n(n − 1)(n − 2)...(2)(1) A generalization of this is the multifactorials where:
Continue ReadingWhy Is Char[] Preferred Over String for Passwords?
In Swing, the password field has a getPassword() (returns char[]) method instead of the usual getText() (returns String) method. Similarly, I have com
Continue ReadingC++: GUI Component Interaction
Almost every application needs to communicate with the user in some way. Therefore, a substantial part of the code deals with the interaction of progr
Continue ReadingC++: Forward Difference
Provide code that produces a list of numbers which is the n-th order forward difference, given a non-negative integer (specifying the order) and a lis
Continue Reading




