Thanks Mate.
but how can i create a tree then.. Can i have your email address, i iwll try & send u the PDF file for this problem.. if thats not a problem to you..
Essentialy a problem is of trees and paths.. so from that integer value i have to create trees and then profit is the value associated with each path of the tree... and i have to calculate the max profit by traversing through the paths (but thats a second part,cnt even complete first part

)
and y is nothing but an integer... if u start from 1.. then first pair will be smthing like 0 -1.. where 0 is the parent and -1 is the profit associated with it...
[ October 19, 2005: Message edited by: Ernest Friedman-Hill ]