
Recent Posts
Recent Comments
Thea Tippit on C++ Idioms to Handle Tupp… The Sunday Programme… on Longest Palindromic Substring Roopak Selvanathan on Longest Palindromic Substring Anne Marie Benoit on Why use Latex over Word Sujay Anand on On Computing the Fibonacci Num… Archives
 May 2021
 July 2020
 January 2020
 November 2019
 September 2019
 August 2019
 August 2018
 June 2018
 March 2018
 January 2018
 May 2017
 February 2017
 January 2017
 October 2016
 June 2016
 May 2016
 April 2016
 February 2016
 January 2016
 November 2015
 September 2015
 August 2015
 July 2015
 June 2015
 May 2015
 April 2015
 March 2015
 February 2015
 January 2015
 December 2014
 January 2014
 July 2013
 June 2013
 January 2013
 December 2012
 November 2012
 August 2012
 March 2011
 February 2011
 January 2011
Categories
Meta
Author Archives: The Sunday Programmer
Outline of a Computer Program to play Tic Tac Toe
Tictactoe (American English), noughts and crosses (Commonwealth English and British English), or Xs and Os/“X’y O’sies” (Ireland), is a paperandpencil 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
Posted in Uncategorized
Leave a comment
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
Posted in Languages, Linux, OCaml, Software Engineering
Leave a comment
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
Posted in Algorithm, Python, Software Puzzle
Leave a comment
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 substring 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 (Ni)*xi) mod 10 = … Continue reading
Posted in Algorithm, C++, Software Puzzle
Leave a comment
Linq for C++
Motivation The benefits of SQLlike 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
Posted in C++
Leave a comment
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
Posted in Algorithm, C++
Leave a comment
Why use Latex over Word
Word is an application that helps layout documents. Latex is a similar application except that it is not a Graphical User Interface (GUI) application like word. It is a notation that must be transformed or compiled from markup text to … Continue reading
Posted in Information Processing, Uncategorized
1 Comment
Arithmetic Division: Old wine in new bottle
Given two positive integers A and B compute the quotient and remainder without using multiplication. This is an old problem except, in optimising the algorithm we derive the long division method taught in primary school. Problem: Given A and B, … Continue reading
Posted in Uncategorized
Leave a comment