Tree formation: class Node { public: Node(value) { nValue = value; pLeft = pRight = NULL; } Node* pLeft; Node* pRight; int nValue; // or any other data } class Tree { public: Node* pRoot; Tree() { pRoot = NULL; } Node* search(int value); //... void createLeaf(int value); //... // ... }

Geeks for geeks (Update: Feb 15, 2013)

http://www.geeksforgeeks.org/find-the-minimum-distance-between-two-numbers/

http://www.geeksforgeeks.org/minimum-number-of-jumps-to-reach-end-of-a-given-array/

http://www.geeksforgeeks.org/check-if-each-internal-node-of-a-bst-has-exactly-one-child/

http://www.geeksforgeeks.org/majority-element/

http://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/

http://www.geeksforgeeks.org/given-an-array-arr-find-the-maximum-j-i-such-that-arrj-arri/

LeetCode must read problems:

http://www.leetcode.com/2010/04/how-to-determine-if-point-is-inside.html

http://www.leetcode.com/2010/04/rotating-array-in-place.html

http://www.leetcode.com/2010/09/fun-with-bit-operations.html

http://www.leetcode.com/2010/09/number-of-1-bits.html

http://www.leetcode.com/2010/09/printing-binary-tree-in-level-order.html [Done]

http://www.leetcode.com/2010/09/determine-if-binary-tree-is-binary.html [Done]

http://www.leetcode.com/2010/09/printing-binary-tree-in-zig-zag-level_18.html [Done]

http://www.leetcode.com/2010/10/print-edge-nodes-boundary-of-binary.html [Done]

http://www.leetcode.com/2010/11/stack-that-supports-push-pop-and-getmin.html

http://www.leetcode.com/2010/11/largest-binary-search-tree-bst-in_22.html [Done]

http://www.leetcode.com/2011/01/find-k-th-smallest-element-in-union-of.html

http://www.leetcode.com/2011/05/determine-if-two-rectangles-overlap.html

http://www.leetcode.com/2011/07/lowest-common-ancestor-of-a-binary-tree-part-ii.html [Done]

http://www.leetcode.com/2011/08/reverse-bits.html

GeeksForGeeks data structure link:

http://www.geeksforgeeks.org/forum/tags/data-structures

Cool questions:

http://www.geeksforgeeks.org/archives/category/linked-list

Diameter of tree: http://www.geeksforgeeks.org/archives/5687 [Done]

Three way partitioning: ( low and high are the numbers you want to partition by. p and q are regular quick sort counters. Check anything lower than low and swap it with the number placed at p and increment p, parallely, check anything more than high and swap it with the number placed at q and decrement q

void threeWayPartition(int data[], int size, int low, int high) { int p = -1; int q = size; for (int i = 0; i < q;) { if (data[i] < low) { swap(data[i], data[++p]); ++i; } else if (data[i] >= high) { swap(data[i], data[--q]); } else { ++i; } } } 2 way partitioning: Low = 0 , High = n-1 A[low] = 0.. Lo++, 1.. A[lo]><A[high] & low++ & high-- 3 way partitioning: Low = 0, Mid = 0, High = n-1 A[mid] = 0.. a[low]><A[mid] & low++ & mid++, 1.. mid++, 2.. a[mid]><a[high] & mid++ & high--