Friday, March 30, 2007

Welcome to Vista

Well I'm not really sure if I love or hate Vista just yet.

The Good:

  • I resized my drives and created new partitions with vista
  • After 500MBs of patches I got visual studio running

The Bad:

  • Using an installer over the network seems to lock my machine
  • File IO and network speeds seem much slower than XP

Thursday, March 29, 2007

Laptop Watch: Day 3

Its here writing this post!

I'll have much more to say once I get it all going. Sadly I've managed to crash vista twice already.

Wednesday, March 28, 2007

Microsoft Coding Question #1

I recently had the privilege of interviewing at Microsoft. I figured I'd post the technical questions and answers in case they might help someone out there.

So here is the first one:

Given a Binary Tree, provide a method to traverse it depth first. Print the value of each node to the console.

We will assume there are methods to get the root node of a tree (rootNode) and the left and right nodes of a node (leftNode, rightNode)

Ex:



Should print 2,3,1,4,5


Solution (Recursive):

public void printTree(BinaryTree tree)
{
   if(tree !=null)
       printNodes(tree.rootNode);
}

private void printNode(Node node)
{
   if(node != null)
   {
       Console.writeLine(node.data);
      printNode(node.leftNode);
       printNode(node.rightNode);
   }
}

Solution (Non-recursive):

public void printTree(BinaryTree tree)
{
    if(tree !=null)
    {
       Stack<binarytree.node> stack = new Stack<binarytree.node>;
       stack.Push(tree.rootNode);
       while (stack.Count != 0)
          {
          BinaryTree.Node          currentNode = stack.Pop();
          Console.WriteLine(currentNode.data);

          if             (currentNode.rightNode != null)
                stack.Push(currentNode.rightNode);
            if (currentNode.leftNode != null)
               stack.Push(currentNode.leftNode);             }
         }
      }

Laptop Watch: Day 2

TORONTO SORT CTR/CTR TRIE, ON

W00t!!! My laptop is now in the same country as me!

Tuesday, March 27, 2007

Dell Laptop watch, Day: 1

TRACKING DETAILS

2007/03/27 07:30 In Transit in U.S.




So as far as I know I have a beautiful new laptop some where in the United States.