Wednesday, December 9, 2009

Reversing a Double Linked-List in C++ using a 'reference pointer'

Here's an example I wrote for how to reverse a double (or 'doubly' as some people like to say) linked-list. The main point of this example is to show that reference pointers are actually useful in the real world. In this particular example it has two advantages: to avoid having to return a Node* and to make the code clearer. The alternative is to use a Node** or Node*** but the code is less readable.

Here is the example - and because i'm an ex ZX Spectrum junkie, it's using the original speccy font! If you don't know what a ZX Spectrum is, go to http://www.worldofspectrum.org


No comments:

Unweaving the Rainbow, by Richard Dawkins

We are going to die, and that makes us the lucky ones. Most people are never going to die because they are never going to be born. The potential people who could have been here in my place but who will in fact never see the light of day outnumber the sand grains of Sahara. Certainly those unborn ghosts include greater poets than Keats, scientists greater than Newton. We know this because the set of possible people allowed by our DNA so massively outnumbers the set of actual people. In the teeth of these stupefying odds it is you and I, in our ordinariness, that are here.
RichardDawkins.net

Books I am reading this book at the moment:

Atheist

The Out Campaign: Scarlet Letter of Atheism