@all,
when we use a 2D array/matrix to implement graphs, how can we traverse
efficiently from starting node to ending node?

take a look at of these problems
Graph problem:
https://www.interviewstreet.com/challenges/dashboard/#problem/4f40dfda620c4
Tree Problem:
https://codeninja.interviewstreet.com/challenges/dashboard/#problem/4f75c32310103

How can we implement such problems efficiently in a language like Java?

On Tue, May 29, 2012 at 4:07 PM, Jeevitesh <[email protected]>wrote:

> We can use the following data structure for Graphs:-
> - Adjacency Lists(More generally used)
> - Adjacency Matrix(Takes a lot of space but good for dense graph)
>
> For Trees:-
> We can model a node such that it has two pointers one of which points to
> its first child while the other points to the next peer or sibling.
>
>
> On Tue, May 29, 2012 at 4:03 PM, Hassan Monfared <[email protected]>wrote:
>
>> 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.
>>
>
>
>
> --
> *Thanks,
> Jeevitesh Shekhar Singh.*
>
>
>  --
> 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.

Reply via email to