Given a graph, find if it represents a tree
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Given a graph, find if it represents a treeAlgorithm
Ans. We can simply find it by checking the criteria of a tree. A tree will not contain a cycle, so if there is any cycle in the graph, it is not a tree. We can check it using another approach, if the graph is connected and it has V-1 edges, it could be a tree. Here V is the number of vertices in the graph

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


Related Questions

  Can you provide some implementation of a Dictionary having large number of words ?
 In a Linked list with sorted numbers, insert a new numbers while maintaining the sort order.
 What is the difference between Graph's Breadth first and Depth First algorithm ?
  What are the pre-requisite for the collection to perform Binary Search ?
 Explain various Searching and Sorting Algorithms ?
 Write a program for LinkedList, with method to append node and traversing the list ?
  Which sorting algorithm is used by Collections.sort() in Java ?
  How to determine if the linked list has a cycle in it ?
 Write an Algorithm for Graph Traversal ? The Graph has a loop.
 Write an algorithm / java program for Heap Sort ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: