# Book - Hackers & Painters

A couple of days ago, I finished reading Paul Graham’s book of essays Hackers and Painters: Big Ideas from the Computer Age, and thoroughly enjoyed the book. I had already read a few of these essays on his website, yet I still enjoyed re-reading them. The essays are very insightful, and I plan to re-read several essays & passages periodically.

# A Quine in Objective-C

A quine is a program that takes no input and outputs its own source code. It has been a while since I last wrote a quine, so I figured I’ll write one in Objective-C. In general, quines follow a fairly simple formula. The program contains a string that includes all the code before the string and all the code after the string. Depending on the programming language, the string might also contain format string (for languages that use format-strings to print to `stdout`)

# Finding the Start of a Loop in a Circular Linked List

A lot of people are familiar with the problem of detecting a loop in a linked list. The problem goes as follows: “Given a linked list, what is the algorithm to determine if it has any cycles (loops)?”

# Stern-Brocot Tree

Stern-Brocot tree is a tree data structure whose vertices correspond to the set of non-negative rational numbers. Thus, this tree provides a very elegant way for constructing the set of fractions `m/n`, where `m` and `n` are relatively prime. To construct the tree, the basic idea is to start with two fractions (`0/1`, `1/0`) and then repeat the following operation:

Insert (m+m’)/(n+n’) between two adjacent fractions m/n and m’/n’