### Blogroll

### Topics

- Apartment rental and roommate finding
- Array and linked list
- Backtrack
- Binary search
- Bit operation
- C++
- Complexity
- Divide and Conquer
- Dynamic programming
- File operation
- Geometry
- Graph
- Greedy algorithm
- Hashtable and Map
- Heap
- JAVA
- Large scale data
- Number trick
- Object orientated design
- Probability
- Recursive
- Stack and Queue
- String
- Threads and locks
- Tree
- Uncategorized

### Archives

# Monthly Archives: August 2012

## The difference between copy construct function and assign function of a class

1. The copy construct function creates a new object, while the assign function assigns an object to an existed object. 2. The assign function needs to check if the assignment source and destination are the same, while the copy construct … Continue reading

Posted in C++
Leave a comment

## Unique binary search trees II

Given n, generate all structurally unique BST’s (binary search trees) that store values 1…n. For example, Given n = 3, your program should return all 5 unique BST’s shown below. 1 3 3 2 1 … Continue reading

Posted in Recursive, Tree
Leave a comment

## Unique binary search trees

Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 … Continue reading

Posted in Binary search, Dynamic programming
Leave a comment

## Convert characters to number.

Implement function to convert characters to integer number with any base. C++: 01 int myAtoi(char* A, int base) 02 { 03 int a=0; 04 int index=0; 05 int s=1; 06 if(A[0]==‘-‘){ 07 s=-1; 08 … Continue reading

Posted in Array and linked list, String
Leave a comment

## Convert number to characters

Implement a function to convert integer number to characters with any base. C++: 01 void myItoa(int num, char* A, int base) 02 { 03 int index=0; 04 int k=1; 05 if(num<0){ 06 num=-num; 07 … Continue reading

Posted in Array and linked list
Leave a comment

## Summation of linked list represented numbers.

You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s digit is at the head of the list. Write a function that adds … Continue reading

Posted in Array and linked list
Leave a comment

## Linked list partition

Write code to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x. C++: 01 void enList(Node** head, Node*& tail, Node* toAdd) 02 { 03 if(*head){ … Continue reading

Posted in Array and linked list
Leave a comment