Code Samples


This is code written as part of the Stanford course CS106X.

  • Game of Life. Implements the back-end of the cellular-automata based simulation of Conway's Game of Life.

  • Word Ladder. Given a dictionary (set) of words, two words are connected if you can change a single letter of one to get the other. This program finds whether there exists a ladder between two words A and B, in which case it outputs it.

  • Random Sentence Generator. Given a context-free grammar, this program generates text from the grammar by randomly choosing between the possible production rules.

  • N-grams. An n-gram is a sequence of n words. A text can be represented as sequence of transitions between n-grams. This program reads a text and constructs a Markov Chain model based on n-grams and uses this model to generate similar text.

  • PQueue. This program implements 3 different versions of Priority Queues based on an array, a linked-list and a Binary Heap.

  • Huffman. This program reads a binary file and compresses/decompresses it according to Huffman coding scheme.

  • TrailBlazer. This program implements Dijkstra, Astar, Prim's and Kruskal's algorithms.

  • Stanford123. This program implements a simplified version of MSExcel. Main features include the use of inheritance as well as parsing and handling regular expressions.