## Print All Combinations of a Number as a Sum of Candidate Numbers

September 30, 2010

Given a target number, and a series of candidate numbers, print out all combinations, so that the sum of candidate numbers equals to the target.
Read the rest of this entry →

## Serialization/Deserialization of a Binary Tree

September 29, 2010

Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called ‘serialization’ and reading back from the file to reconstruct the exact same binary tree is ‘deserialization’.

## Saving a Binary Search Tree to a File

September 28, 2010

Describe an algorithm to save a Binary Search Tree (BST) to a file in terms of run-time and disk space complexity. You must be able to restore to the exact original BST using the saved format.

## How to Pretty Print a Binary Tree

September 18, 2010

Have you ever thought of pretty-printing a binary tree?
Read the rest of this entry →

## Printing a Binary Tree in Zig Zag Level-Order

September 18, 2010

Given a binary tree, print out the tree in zig zag level order (ie, from left to right, then right to left for the next level and alternate between). Output a newline after the end of each level. Read the rest of this entry →

## Binary Tree Level-Order Traversal Using Depth First Search (DFS)

September 17, 2010

Given a binary tree, print out the tree in level order (ie, from left to right, level by level). Output a newline after the end of each level. Breadth First Search (BFS) is not allowed. Read the rest of this entry →

## Printing a Binary Tree in Level Order

September 16, 2010

Given a binary tree, print out the tree in level order (ie, from left to right, level by level). Output a newline after the end of each level. Read the rest of this entry →

## Determine if a Binary Tree is a Binary Search Tree (BST)

September 14, 2010

Write a function isBST(BinaryTree *node) to verify if a given binary tree is a Binary Search Tree (BST) or not.

## Detecting a Loop in a Singly Linked List

September 11, 2010

Given a singly linked list, find if there exist a loop.

September 11, 2010

Given a list, split it into two sublists — one for the front half, and one for the back half. If the number of elements is odd, the extra element should go in the front list. So FrontBackSplit() on the list {2, 3, 5, 7, 11} should yield the two lists {2, 3, 5} and {7, 11}.

## Number of 1 bits

September 9, 2010

Write a function that takes an unsigned integer and returns the number of ’1′ bits it has. Read the rest of this entry →

## Fun with Bit Operations

September 8, 2010

What does the following function mystery() do?