I first looked at other questions and did not find any proper answer. Suppose there is a 2 dimensional Array given where two nodes are saved and also as Input an Integer which h