Monthly Archives: May 2008

Tree Traversal – Python

Another question posed in the Programming Interviews Exposed book. A pre-ordered traversal of a binary tree (counterclockwise starting at root, printing nodes as you encounter them) is pretty straight forward, and a very natural thing to implement with recursion: A … Continue reading

Posted in programming | Tagged , , , | 4 Comments

Linked List – Cyclic or Acyclic?

Another problem in the Programming Interviews Exposed book (see previous post) is to determine whether a Linked List is cyclic or not. The most obvious way to do this is to iterate over the list, checking whether the next element … Continue reading

Posted in programming | Tagged , , | 3 Comments

More on Linked Lists – flattening and unflattening

More from the Programming Interviews Exposed book (see last post). In this problem you take a double linked list (where each node knows its previous and next nodes) with child elements, and flatten it. Then unflatten it back to its … Continue reading

Posted in programming | Tagged , , , | Leave a comment

Linked List Interview questions

I hadn’t done much programming for a while and thought I’d best brush up on some basic data structures and algorithm. The following is from Programming Interviews Exposed. I implemented some of the Linked List stuff in the first section … Continue reading

Posted in programming | Tagged , , | 2 Comments