Posts

Getting started with Windows GDI graphics applications in C++

Image
A guide to getting started with Windows graphics applications for the very first time. The Windows Graphics Device Interface (GDI) forms the basis of drawing lines and objects, and from this device contexts. I will not go into any detail about these concepts in this post. I just want to show a simple means of getting started with things like the drawing of lines and objects in Windows applications. There is nothing stopping you from reading further on the subject to increase your understanding.

Templates in C++

An introduction to using template classes in C++, that starts extremely simply and builds up from there...

Printing the contents of STL containers in a generic way

A generic Print function A way of using STL algorithms combined with template functions as a means of printing the contents of any type of STL container (eg a std::vector ), containing any generic data type (eg int , std::string etc). typename T defines the generic data type held by the container, while typename InputIterator describes the STL container iterators passed to it:

Kruskal's Algorithm in C++

Image
A simple C++ implementation of Kruskal's algorithm for finding minimal spanning trees in networks. Though I have a previous posting that accomplishes exactly the same thing, I thought that a simple implementation would be useful, one using a straightforward Graph data structure for modelling network links and nodes, does not have a graphical user interface and does not use the Boost Graph Library, which can be complicated to use and not to everyone's preference.

How to sort items contained in STL maps

By definition you cannot sort a std::map by value, since a std::map sorts its elements by key. This posting documents a way to get around this by dumping std::map key-value pairs into a std::vector first, then sorting that std::vector with a less-than functor afterwards

Modeling networks as graphs in C++

After playing around with some graph algorithm code as implemented by Sedgewick and others, I have come to the conclusion that while these are efficient and concise, improvements could be made to their usability.

Finding substrings within strings using the Boyer-Moore-Horspool Algorithm in C++

Ever wondered what computer algorithm gets employed when using Ctrl-F to search for specific words in a page of text?