Q28. Consider two undirected trees are represented using adjacency matrix. Write a program which checks whether the tree with less number of vertices is a sub-tree of another tree.
Input File: Contains Adjacency List (Comma separated list of vertices)
InputFile.txt Example
0,1,1,0,0,0,0
1,0,0,1,1,0,0
1,0,0,0,0,0,0
0,1,0,0,0,0,0
0,1,0,0,0,1,1
0,0,0,0,1,0,0
0,0,0,0,1,0,0
------------------------
Input File2 Example
0,1,1,0,0
1,0,0,0,0
1,0,0,1,1
0,0,1,0,0
0,0,1,0,0
------------------------
for example:
Output File:
Yes <FileName1> is sub tree of <FileName2> tree/No
<Node of FileName1> ->[can be represented by] <Node of FileName2> [to assume FileName1 is sub tree of FileName1]
OutputFile.txt Example
Yes,InputFile2 is sub tree of InputFile1 tree
1->2
2->4
3->5
4->6
5->7
1
Expert's answer
2013-11-27T10:12:14-0500
Unfortunately, your question requires a lot of work and cannot be done for free. Please submit it with all requirements as an assignment to our control panel and we'll assist you.
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment