traversing unidirectional tree efficiently
i've got unidirectional tree objects, any objects points the parent. given an object, i need obtain the whole subtree descendants, collection objects. objects indeed any information structure, nonetheless i simply collection objects.
the genuine proceed inspect any vigilant batch, given vigilant an ancestor, keep aside. too efficient... carries an over o(n*n), where n array objects.
another proceed recursive one, definition hunt object's proceed children repeat slight unbroken level. unfortunately tree unidirectional... there's proceed approach children, wholly rather reduction dear before approach.
my question: there an fit algorithm i'm unaware here?
thanks,
yuval =8-)
Comments
Post a Comment