Question: Code in C++ Complete the code of a recursive function findShortestPath below that takes a pointer to the root of a binary tree and returns

Code in C++

Complete the code of a recursive function findShortestPath below that takes a pointer to the root of a binary tree and returns a vector of keys on the shortest path between the nodes with the given key values (k1 and k2)

// find a shortest path between the nodes with the keys k1 and k2 and store the found path in a vector path

// return true if a path exists otherwise false

bool findShortestPath(Node *root, std::vector &path, int k1, int k2)

{

}

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!