RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext and Other Long Function Names

Every reader should ask himself periodically “Toward what end, toward what end?” — but do not ask it too often lest you pass up the fun of programming for the constipation of bittersweet philosophy.

– Alan J. Perlis [foreword to SICP]

RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext (53 characters)

I find long functions names charming — I think they impart a certain personality to the API and add to the fun of programming. And while I try to avoid excessively long names in my own code at work (unless they add to clarity), I never fail to get a good kick seeing such names used by other programmers! Continue reading

The Wire Identification Problem

The Wire Identification Problem: Try to label the wires on the right with labels corresponding to those on the left

A bunch of n wires have been labeled at one end with alphabetic codes A, B… The wire identification problem asks for an efficient procedure to mark the other end of the bunch with the corresponding labels. The wires run underground so you can’t track them individually and any wire is visibly indistinguishable from any other (except for the labeling). Continue reading

Kernighan & Plauger on Programming Style

Last week I finished reading Kernighan & Plauger‘s beautiful book The Elements of Programming Style, the classic that pioneered the term programming style. I’ve excerpted below some rules of style from that book. I hope these get you excited to reading the book too!

Continue reading

On Asymptotic Methods in Analysis: Prof. de Bruijn’s beautiful little book

For the past several days, I’ve been working my way through Prof. N.G. de Bruijn’s book Asymptotic Methods in Analysis; and I want to share some of the fun I’ve had reading it.

This post is not a review or anything (here’s an image of the back cover with some reviews). Below are just fragments of what I’ve read so far and found fascinating. Continue reading

Read wrote Wright… Graph Theorists playing with words

Frank Harary, Oberwolfach (1972)

I was going through the first chapter of the book Graphical Enumeration by Frank Harary and Edgar M. Palmer when I chanced upon this perplexing footnote:

Read wrote Wright that both Read [R2]1 and Wright [W3]2 were wrong. So Read and Wright wrote a joint erratum [RW1]3 to set things right. This may be wrong since Wright asserts that Wright wrote Read first.

Continue reading

  1. [R2] R.C. Read, The number of k-colored graphs on labelled nodes, Canad. J. Math. 12, 409–413 (1960).
  2. [W3] E.M. Wright, Counting coloured graphs, Canad. J. Math. 13, 683–693 (1961).
  3. [RW1] R.C. Read and E.M. Wright, Coloured graphs: A correction and extension, Canad. J. Math. 22, 594–596 (1970).

Solving Project Euler Problems 161 (Trominoes Tiling) and 185 (Number Mind) with ZDDs

Some months ago, I was re-introduced to Project Euler (PE) through the blogosphere. I had visited that site before, but had been left unmotivated by the first dozen or so problem statements that I read — neither the programming nor the math involved anything new or challenging. Only in the past few months, when I attempted to crack some of the harder nuts, did I realize how interesting many PE problems could be — requiring a neat algorithm (or invoking a crucial theorem) for an efficient solution. Continue reading

Fun with ZDDs: Notes from Knuth’s 14th Annual Christmas Tree Lecture

Don Knuth

In this entry, I’ll attempt to record the important ideas Knuth presented in his 14th Annual Christmas Tree Lecture, part of his regular Computer Musings.

While I wasn’t fortunate enough to attend the lecture in person, I did go through the recording that, thankfully, was quite well done. Like all other “musings”, this one included some fascinating anecdotal bits (no pun intended) and Knuth’s good sense of humor was sprinkled throughout; but most noticeable was his infectious enthusiasm for the topics he spoke about. Continue reading

Analytically evaluating a limiting probability (June 2007 Ponder This)

In this post, I’ll describe my solution to June 2007’s Ponder This. I had felt that my solution was kind of nifty, and different from the one that was published. It had actually taken me several days to work the whole thing out.

Here’s part (2), the tougher part, of the problem: Values for a random variable are generated independently and uniformly over \left[0,1\right). By accumulating these values, your job is to reach a sum between n+x and n+1, where n is a positive integer, and 0\,\textless\,x\,\textless\,1. Continue reading

In lieu of a foreword

In this blog, I plan to write about the fascinating/curious stuff that I come across. My plan, for the moment, is to stick to topics I have some familiarity with: CS/math, programming, tools. I’ve a deep interest in certain areas of mathematics and computer science — analysis, combinatorics, probability theory, design & analysis of algorithms, graph theory & network effects, computational problems. Many of my posts would be on these topics. Some would be about EMACS, the one true editor. The remainder would be on programming languages, performance hacks, bitwise tricks… Continue reading