Skip to main content


Showing posts from August 6, 2017

Binary Trees

Trees Binary trees are widely used data structures. Similar to linked lists, they are inductively defined: a binary tree node is comprised of a value and two child binary tree nodes, left and right. A binary tree can also be empty. The node that a child of no subtree is called the root. Binary trees are most useful in contexts where data has some kind of ordering since one can put the lesser nodes (with respect to a given node) on the left and the greater ones on the right. Binary trees tend to show up quite a bit in interviews because there are a lot of interesting problems you can ask about them. The key concept you need to learn is the many ones one can traverse a binary tree. Tree in programming are more like family trees (without accounting for marriages) in that they grow downward. A diagram that lists your great great grandparent and all descendants would be a good example. Consider the following binary tree: 1 / \ 2 3 / \ \ 4 5 6 The four mo…

Code Reviews, Part 1

Why Code Reviews? Code review is a practical and important skill that truly distinguishes the highly experienced engineer. Knowing what are the common pitfalls, where to look for them, and how to understand someone else's code quickly is an invaluable skill to have. It is also a skill that is rarely taught in school. To really ramp up your programming skills, get out there and read other people's code. Reading high quality code is a good learning experience. Occasionally reading poorly written code is also insightful. What are the most common errors and where do you find them? Through code reviews, software engineers can spread knowledge through their teams as well as improve consistency and code quality. For the interviewee, you have to review your own code, so it helps to know what are the things you need to double check. One great way to evaluate a team's culture is to probe and understand their code review practices or lack thereof. Below, I will cover some of the best…