Author Archives: The Sunday Programmer

About The Sunday Programmer

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

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 Uncategorized | 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+1)*xi) mod 10 = … Continue reading

Posted in Uncategorized | Leave a comment

Linq for C++

Motivation The benefits of SQL-like declarative syntax for imperative programming languages like C# is [well documented]( 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 Uncategorized | Leave a comment

Multiway Trees

“Rien n’est plus dangereux qu’une idée, quand on n’a qu’une idée.” Émile-Auguste Chartier Abstract In considering how to print a multiway tree in heirarchical fashion, this blog shows that there are many ways to represent a multiway tree in a … Continue reading

Posted in C++, Data Structure, Software Engineering | Tagged , , | 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 Uncategorized | 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 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