Question Design an algorithm to verify that a tree is a universal value binary tree. Universal value binary tree means all value in that tree is the same. Solution There is…

Question This is an actual question I encountered in an Amazon phone interview in November 2013. You are going to design the money changing algorithm for a vending machine. That…

Question Given a number, find the number of 1 in the number's binary expression. For example, binary express of 10 is 1010. So the number of 1 in it is 2.…

Question Consider there are 4 blue and 4 red cards. Host gets 2 cards randomly, no one knows what cards they are. Then he places 2 random cards at the…

Question You have 9 marbles. 8 marbles weigh 1 ounce each, & one marble weighs 1.5 ounces. You are unable to determine which is the heavier marble by looking at them. You…

Question Write an algorithm to remove duplicated node from a linked list. Solution There are many ways to do it. For the first one, as the simplest one, we could…

Question Print a binary tree layer-by-layer from top to bottom, and from left to right for each layer. Solution Yes, it's a simple task. We can use breadth-first search, and…

Question Construct 2 algorithms to make mirror image of any binary tree inputs, one of them using recursive method, another one using looping method. Mirror image means a binary tree…

Given a sorted integer list and an integer, find two integer in the list such that the sum of the two integers equals the given integer. It is required that the time complexity must be O(n).

Question Convert binary search tree into doubly linked list. It's required not to create any new node, but only turning pointers. Solution The following shows the concept of this question.…

What's happening One day, when I opened up terminal as usual, it showed [Process completed] and just terminated. I could not type any thing, run any scripts and work on…

For both server and website developing, I usually use Xampp's Apache to create a localhost server. However, I hate to put my important files in the htdocs inside Apache. Instead…

To capture screen in BlackBerry PlayBook, just hold the volume Up and Down buttons together. After a camera shutter sound, a screen image in the format JPG will be saved…

Hi there, its been a long time that InstaMusic haven't been updated. Sorry for that because I had been so busy in working on a game project in my company. Anyway,…

Thank you for checking out this tutorial. Reading the discussions in this post, seems like there is quite a number of people having troubles to take screenshots with Galaxy S2.…

Today, I moved my nicholasworkshop.wordpress.com to my owned domain nicholasworkshop.com, integrated with my old portfolio website. Thanks to my subscribers, my blog has been having a steady viewing rate over time.…

It's quite often for a developer to make use of the user agent to determine what browser does a user used, especially for those who develop web services and websites.…