Cyclic Linked List – Python function to find the node at the start of the loop

Sunday, July 18th, 2010

I'd blogged previously about writing a python function to find out whether a linked list is acyclic or not - it's worth a read before tackling this one. Problem: Given the head node of a cyclic (or circular) linked list, write a function to return the node that is at ...

Mth to last – a recursive approach

Thursday, June 12th, 2008

A collegue of mine was pondering the mthToLast problem for a LinkedList I'd blogged about previously and sent me the following IM message: just a guess - but can you use recursion to solve your link list m problem? a method to track through the list which calls itself, then ...

More on Linked Lists – flattening and unflattening

Friday, May 30th, 2008

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 original structure. It took me a few ...