Skip to content

VMware 2nd Interview - Create a class which represents a DAG (directed acyclic graph)

Notifications You must be signed in to change notification settings

mytask1234/vmware-2nd-interview-DAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VMware 2nd Interview - Create a class which represents a DAG (directed acyclic graph)

The requirements are:
Create a class which represents a DAG (directed acyclic graph) and has the following methods:
Node createNode(String value): Creates a new node in the graph. Returns the created Node.
void createEdge(Node src, Node dest): Creates a new edge which connects two existing nodes in the graph. The direction of the new edge is from src to dest.
boolean isAncestor(Node src, Node dest): Return true if and only if there is a (directed) path from src to dest.
Set findAllAncestors(Node dest): Returns a set of all ancestors of dest.

See my solution in class:
com.vmware.DAG

Hope it helps you :)

About

VMware 2nd Interview - Create a class which represents a DAG (directed acyclic graph)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages