Tuesday, September 25, 2012

Given a tree, return an array A

where A[i] is the head of a linked list containing all the elements at level i.

1 comment:

  1. It's possible to use a Breadth-first visit and keep track of the level.
    When a node is visited, it inserted at A[level].
    A[level] will be created whenever it doesn't exist.

    Fabio
    fabioang@gmail.com

    ReplyDelete