Thursday, March 15, 2012

Another quick(?) question

I was asked: In your opinion, from a Google perspective, what qualities make up a great CTO?

I'm not sure what a “Google perspective” is, but I can dig up an uniformed opinion or two (or three).

As an officer of a business, a CTO has the primary responsibility of keeping the business going and growing (“maximizing shareholder value”), with particular emphasis on the technological tools the company uses and perhaps creates. A good CTO would be well-informed about where the state-of-the-art is and where it will be in a few years and what tools will give the most advantage with the least cost and risk.

That's the business school answer. I didn't go to business school.

I have been employed by a few companies that were big enough to have a CTO, and I have a different opinion in that context. While I want the company to be successful, and I do my part to help, I don't have the responsibility to consider the “business issues” associated with the technology. I personally take into consideration the effect that the technology has on my job and my co-workers jobs. I went to a tech school because I like technology for its own sake. I like to hang out and work with others that feel the same way. As an employee, I want a CTO that does what is necessary for the business, but also provides sufficient tools and “toys” so that my job is interesting, exciting, and challenging. If the work is dull, tedious, and requires little thought, I start to daydream about something better.

You can see that my desires aren't perfectly aligned with the CTO's responsibilities, so a company with a “great” CTO might be anathema to me, but a CTO that indulges the engineers of a company much more than is strictly necessary for business would make me more interested in being employed there.

Wednesday, March 14, 2012

Recursion with no base case?

Here's my solution:
(define (all-descendants node-children root)
  (cons root
        (append-map (lambda (child)
                      (all-descendants node-children child))
                    (node-children root))))
I wasn't measuring, but it took me more than a minute. I spent most of that time thinking about transitive closures, queues, iterating over elements, etc., before I realized that since I'm working with a tree rather than a directed graph, I need not worry about shared structure or duplicate elements.

This is an example of a well-founded recursive program that does not have an explicit base case. append-map (mapappend in Common Lisp) implicitly does not call the mapped function if the list argument is empty, so the recursion ends at the nodes of the tree that have no children.

Monday, March 12, 2012

1 minute puzzle

Given a procedure that returns a list of the children of a given node of a tree, write a procedure that returns a list of all the descendants of that node.