you can use adjacency matrices for spare graphs and two dimensional array for non-spare graphs
On Tue, May 29, 2012 at 2:47 PM, prakash y <[email protected]> wrote: > How to implement complex data structures like trees (with unknown no.of > subtrees) and graphs efficiently in C/Java? > I have implemented binary trees in Java as it always contains two nodes. > But I don't know about graphs. > I am not able to solve these problems in coding contests because of this. > Can anyone please suggest me? > > Thanks in advance. > ~Prakash. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
