# Monthly Archives: September 2011

## Android App Idea: Groupon/LivingSocial Proximity Alert

Idea: Send Push notifications when you are nearby a purchased groupon/livingsocial deal. Background: I have a hard time remembering the deals that I bought, especially where the deal is location. It’d be pretty neat to get a notification when I … Continue reading

## Add Two Numbers (C++) refactored

Realized I could make it even cleaner. Changed the while loop condition which makes the code much cleaner gets rid of some unnecessary code. ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { // Start typing your C/C++ solution below // DO NOT write … Continue reading

This is from the http://www.ihas1337code.com/onlinejudge website.  His onlinejudge testing is really neat. I’d like to setup something like that. // Definition for singly-linked list. // DO NOT modify this. struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) … Continue reading

## Iterative InOrder Tree Traversal 2 (C++)

Found this from another website, http://www.ihas1337code.com. It’s so much cleaner. void iterativeInOrderTraverse2(Node *root) { stack<Node *> nodes; Node *currNode = root; while(!nodes.empty() || currNode) { if (currNode) { nodes.push(currNode); currNode = currNode->left; } else { currNode = nodes.top(); nodes.pop(); printf(“%c … Continue reading

Posted in Coding | Tagged , , | 2 Comments

## Iterative PreOrder Tree Traversal (C++)

PreOrder Traversal means displaying the root first, then traverse left subtree, and then traverse the right subtree. Because a stack is LIFO (last in first out), we need to be careful how we insert the nodes into the stack. We … Continue reading