The Fibonacci sequence is a sequence Fn of natural numbers defined recursively: F0 = 0 F1 = 1 Fn = Fn-1 + Fn-2, if n>1 Write a function to ge
Continue ReadingC++: Enforced Immutability
Demonstrate any means your language has to prevent the modification of values, or to create objects that cannot be modified after they have been creat
Continue ReadingC++: Empty String
Languages may have features for dealing specifically with empty strings (those containing no characters). The task is to: Demonstrate how to a
Continue ReadingC++: Delegates
A delegate is a helper object used by another object. The delegator may send the delegate certain messages, and provide a default implementation when
Continue ReadingC++: Check That File Exists
In this task, the job is to verify that a file called "input.txt" and the directory called "docs" exist. This should be done twice: once for the curre
Continue ReadingC++: Heap Sort
#include <algorithm> // for std::make_heap, std::sort_heap template <typename Iterator> void heap_sort(Iterator begin, Iterator en
Continue ReadingC++: Insertion Sort
#include <algorithm> template<class Iterator> void insertion_sort( Iterator a, Iterator end ) { std::iter_swap( a, std::min_ele
Continue ReadingC++: Mutual Recursion
Two functions are said to be mutually recursive if the first calls the second, and in turn the second calls the first. Write two mutually recursive
Continue ReadingC++: Greatest Subsequential Sum
Given a sequence of integers, find a continuous subsequence which maximizes the sum of its elements, that is, the elements of no other single subseque
Continue ReadingC++: Evolutionary Algorithm
Starting with: The target string: "METHINKS IT IS LIKE A WEASEL". An array of random characters chosen from the set of upper-case letters toge
Continue Reading




