Question: There is a complete binary tree. edges and nodes have positive weight. node weights stored array A [ ] 1d array edge weight (0 mean

There is a complete binary tree.

edges and nodes have positive weight.

node weights stored array A [ ] 1d array

edge weight (0 mean no edge) stored array B[ ][ ] 2d array

Node indices are given form top-to-bottom and left-to-right ( root node index is 1, its left child 2 and so on...).

Starting at the root of the tree and moving to either one of the children from the current node, the goal is to find the minimum total weight (i.e. sum of node and edge weights) path from the root to any one of the leaves.

We need to find minumum total weight path root to leaves.(Tree)

Write a greedy algorithm in function,(this is not a optimal solution why?)

write recursive algorithm in function Write a DP solution in function

write all these in java

write driver code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!