I want to find a way like A->B, B-C , that is more than A-C .
Presume there are N { a1 , a2 , a3 , a4 …….}
First>>>
Select two elements , ai(A) and aj(C) ,and remove them from N
Second>>>
Select two elements am and an
if am = an
find the way aj - am - ai
else
remove them from N
Third >>>
We need to select an other elements from N , while Second , build the way like ai - am -….-an -aj until size of N is empty or find the elements like the way.
Fake code
for