# Category puzzles

# 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`

)

# 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:

Read more…Insert (m+m')/(n+n') between two adjacent fractions m/n and m'/n'