Question: I need to find the shortest path between 2 nodes in the binary tree. This is what I have so far: 125 def find_path (self,

I need to find the shortest path between 2 nodes in the binary tree. This is what I have so far:

125 def find_path (self, element_1_key, element_2_key): This function calls _find path ) "m ittuou can use the vaniables.given here oxdefinenvout wit be usediatind pathbelo this line iline hzantili dine 154 self.element 1 = self.get-Node (element-1.key.# Get the node corresponding to key self.element2 -self.get_Node (element_2_key) Get the node corresponding to key if (not self.element_1) or (not self.element 2): print ("Keys Not present!!") return self.Original element 1 kev = element-1-key * The end points (keys) of the path asdietiginal welementwamkey = element-2-key. The end points (keys) of the path 135 2kex -element_2_key,. The end points self.list I-element-l-keyl,# List for path from key-l self.list2 [element_2_ keyls List for path from key_2 141 142 # To indicate which element is greater. To be used in constructing path if element_1_key
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
