Tuesday, June 12, 2012

How to clone a graph

A nice article on how to clone a graph: http://www.leetcode.com/2012/05/clone-graph-part-i.html

Sunday, June 3, 2012

Reverse a Linked List Recursively and Iterately


struct ListNode {
    ListNode* next;
    int       data;
};

 
ListNode* reverseListResursive(ListNode* head) {

 //Initial
 if(head == NULL) return head;
 if((head->next)== NULL) return head;

 ListNode *newHead = reverseListResursive(head->next);
 head->next->next = head;
 head -> next = NULL;

 return newHead;
}

 
ListNode* reverseListNonResursive(ListNode* head) {

 //Initial
 if(head == NULL) return head;
 //if((head->next)== NULL) return head;

 ListNode *newHead = head;
 ListNode *tempNext = NULL;

 while(head) {
  newHead = head;
  head = head->next;
  newHead->next = tempNext;
  tempNext = newHead;
 }

 return newHead;
}


Tuesday, December 13, 2011

Cloud computing Books

http://blog.sina.com.cn/s/blog_6edef4580100t0oy.html

Monday, December 12, 2011

The Boost C++ Libraries

 The Boost C++ Libraries
http://en.highscore.de/cpp/boost/

http://www.boost.org/

How to use Boost in Visual Studio 2010
 http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010



  1. Unzip the latest version of boost (1.48.0 12/11/2011) into a directory of your choice (e.g. d:\boost_1_48_0).
  2. Create a new empty project in Visual Studio 2010.
  3. Open the Property Manager and expand one of the configuration for the platform of your choice.
  4. Select & right click Microsoft.Cpp..user, and select Properties to open the Property Page for edit.
  5. Select VC++ Directories on the left.
  6. Edit the Include Directories section to include the path to your boost source files.
  7. Repeat steps 3 - 6 for different platform of your choice if needed.




Boost Image Processing (GIL) http://stlab.adobe.com/gil/presentation/index.htm Boost Graph Library http://www.boost.org/doc/libs/1_48_0/libs/graph/doc/index.html

Sunday, December 4, 2011

Big Data --Petabyte

http://en.wikipedia.org/wiki/Petabyte
giga tera peta

Saturday, November 19, 2011

Pigs Get Fat, Hogs Get Slaughtered!

Pigs get fat, Hogs get slaughtered!

I love this proverb, it tells me the most important business rule.