Show a loop which prints random numbers (each number newly generated each loop) from 0 to 19 (inclusive). If a number is 10, stop the loop after print
Continue ReadingC++: Black Scholes Call Option Theta
// Calculate the Black Scholes European call option Theta double BS_Call_Option_Theta(double S, double K, double r, double v, double T) // Para
Continue ReadingC++: Pascal’s Triangle
The task is to print out the first 15 Catalan numbers by extracting them from Pascal's triangle. This enables calculation of Catalan Numbers using onl
Continue ReadingC++: Merge Sort
#include <iostream> using namespace std; void merge(int a[], const int low, const int mid, const int high) { // Variables declarati
Continue ReadingC++: Swap Containers
On lines 7–8, we create two std::vectors and initialise them with values. On line 10, we swap the contents of the two std::vectors using the std:
Continue ReadingC++: Bubble Sort
#include <algorithm> template<typename Iterator> void bubbleSort(Iterator first, Iterator last) { Iterator i, j; for (i = fir
Continue ReadingC++: Benford’s Law
Benford's law, also called the first-digit law, refers to the frequency distribution of digits in many (but not all) real-life sources of data. In thi
Continue ReadingC++: CSV Data Manipulation
CSV spreadsheet files are suitable for storing tabular data in a relatively portable way. The CSV format is flexible but somewhat ill-defined. For pre
Continue ReadingC++: Monte Carlo Methods
A Monte Carlo Simulation is a way of approximating the value of a function where calculating the actual value is difficult or impossible. It uses ran
Continue ReadingC++: Brownian Tree
Generate and draw a Brownian Tree. A Brownian Tree is generated as a result of an initial seed, followed by the interaction of two processes.
Continue Reading




