Joe is an experienced C++/C# developer on Windows. Currently looking out for an opening in C/C++ on Windows or Linux.

## Outline of a Computer Program to play Tic Tac Toe

Tic-tac-toe (American English), noughts and crosses (Commonwealth English and British English), or Xs and Os/“X’y O’sies” (Ireland), is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who … Continue reading

## Iterative Binary Tree Traversal

Traversal of binary trees has a simple recursive solution. This blog describes an iterative C++ function derived from a defunctionalised Ocaml solution to the problem. Introduction Consider the following code to compute the height of a binary tree. This code … Continue reading

## Book Review: Unix System Programming in OCaml

Is Unix System Programming by Xavier Leroy and Didier Rémy worth your time? This blog gives a brief description of what it is, to help you decide. What is Unix System Programming The authors cover the following the topics as … Continue reading

## Check If It Is a Good Array

Problem Leetcode presents the following problem: Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. The array is said to be good … Continue reading

## Longest Palindromic Substring

Problem Write a function that, given an input string, locates and returns the longest sequence in the string that is a palindrome. Solution Every sub-string starting from the longest to the shortest needs to checked as shown below is_palindrome can … Continue reading

Posted in Algorithm, C++, Software Puzzle | 2 Comments

## On computing the checksum

Problem Marius Bancila [Bancila 2018](Chapter 8, Problem 69) describes a checksum computation problem which can be paraphrased as follows: Let X = x1x2…xN where xi is a decimal digit. X is a valid number if (Σi=0N (N-i)*xi) mod 10 = … Continue reading

## Linq for C++

Motivation The benefits of SQL-like declarative syntax for imperative programming languages like C# is [well documented](www.tutorialsteacher.com/linq/why.linq) Linq as it is known in C# has been implemented by more than one team in C++. The main advantages are Improved Readablity Declarative … Continue reading

## A quick note on all permutations

Marius Bancila [Bancila 2018] (Chapter 6, problem 52) poses the next permutation problem as follows: Write a function that, prints on the console all the possible permutations of a given string. and provides a recursive version of the solution as … Continue reading